Download Automatic syntax highlighter generation
Transcript
@O@<t e s t . gla@>==@{@−
I d e n t i f i e r : C IDENTIFIER [ mkidn ]
L i t e r a l : MODULA2 LITERALSQ [ mkidn ]
I n t e g e r : C INTEGER [ mkidn ]
R e g u l a r E x p r e s s i o n : $\ $ [ ˆ \ 0 4 0 ] + [ mkidn ]
@}
@O@<. lido@>==@{@−
RULE : Document : : = ’ { ’ G l a F i l e ’ } ’ ’ { ’ ConFile ’ } ’ ’ { ’ AhFile ’ } ’ END;
RULE :
RULE :
RULE :
RULE :
RULE :
RULE :
RULE :
SymbolDef : : = I d e n t i f i e r END;
GlaSymbolDef : : = I d e n t i f i e r END;
L i t e r a l D e f : : = L i t e r a l END;
L i t e r a l U s e : : = L i t e r a l END;
Co lorDef : : = I d e n t i f i e r END;
ColorUse : : = I d e n t i f i e r END;
PreDefPatternUse : : = I d e n t i f i e r END;
RULE : G l a F i l e LISTOF S p e c i f i c a t i o n END;
RULE : S p e c i f i c a t i o n : : = GlaSymbolDef ’ : ’ R e g u l a r E x p r e s s i o n ’ . ’ END;
RULE : S p e c i f i c a t i o n : : = GlaSymbolDef ’ : ’ PreDefPatternUse ’ . ’ END;
RULE :
RULE :
RULE :
RULE :
RULE :
RULE :
RULE :
RULE :
RULE :
RULE :
END;
RULE :
RULE :
RULE :
RULE :
RULE :
RULE :
RULE :
RULE :
RULE :
RULE :
@}
ConFile LISTOF P r o d u c t i o n END;
P r o d u c t i o n : : = SymbolDef ’ : ’ Elements ’ . ’ END;
Elements LISTOF Element END;
ConSymbol : : = SymbolUse END;
ConSymbol : : = L i t e r a l D e f END;
Element : : = ConSymbol END;
Element : : = ’ & ’ ConSymbol END;
Element : : = ’@@’ ConSymbol END;
Element : : = ’ $ ’ ConSymbol END;
AhFile LISTOF Statement COMPUTE
AhFile . done = CONSTITUENTS C olo rDe f . d e f i n e d ;
Statement : : = SyntaxGroupRule END;
Statement : : = MappingRule END;
SyntaxGroupRule : : = ColorDe f ’ { ’ C o l o r A t t r s ’ } ’ END;
C o l o r A t t r s LISTOF C o l o r A t t r END;
C o l o r A t t r : : = ’ f o n t −f a c e ’ ’ : ’ L i t e r a l ’ ; ’ END;
C o l o r A t t r : : = ’ f o n t −s i z e ’ ’ : ’ I n t e g e r ’ ; ’ END;
MappingRule : : = ColorUse ’ : ’ R u l e R e f s ’ . ’ END;
R u l e R e fs LISTOF RuleRef END;
RuleRef : : = SymbolUse END;
RuleRef : : = L i t e r a l U s e END;
Figure 1: The Eli specification file for our generator.
3