module lang::box::\syntax::Box
rascal-0.34.0
Usage
import lang::box::\syntax::Box;
syntax Main
start syntax Main = Boxx WhitespaceAndComment*;
syntax Boxx
syntax Boxx
= StrCon
| BoxOperator box_operator "[" Boxx* list "]"
| FontOperator font_operator "[" Boxx* list "]"
| "LBL" "[" StrCon "," Boxx "]"
| "REF" "[" StrCon "," Boxx "]"
| "CNT" "[" StrCon "," StrCon "]"
// | "O" SOptions "[" Boxx BoxString Boxx "]"
;
syntax StrCon
lexical StrCon
= [\"] StrChar* chars [\"]
;
syntax StrChar
lexical StrChar
= "\\" [\" \' \< \> \\ b f n r t]
| ![\" \' \< \> \\]
;
syntax NatCon
lexical NatCon = [0-9]+ ;
syntax BoxOperator
syntax BoxOperator
= "A" AlignmentOptions alignments SpaceOption* options
| "R"
| "H" SpaceOption* options
| "V" SpaceOption* options
| "HV" SpaceOption* options
| "HOV" SpaceOption* options
| "I" SpaceOption* options
| "WD"
/*
| "COMM"
| "F" FontOption* options
| "G" GroupOption* options
| "SL" GroupOption* options
*/
;
syntax FontOperator
syntax FontOperator
= "KW"
| "VAR"
| "NUM"
| "MATH"
| "ESC"
| "COMM"
| "STRING"
;
syntax AlignmentOption
syntax AlignmentOption
= "l" SpaceOption* options
| "c" SpaceOption* options
| "r" SpaceOption* options
;
syntax AlignmentOptions
syntax AlignmentOptions
= "(" {AlignmentOption ","}* ")"
;
syntax SpaceSymbol
syntax SpaceSymbol
= "hs"
| "vs"
| "is"
| "ts"
;
syntax SpaceOption
syntax SpaceOption
= SpaceSymbol "=" NatCon
;
syntax Context
syntax Context
= "H"
| "V"
;
syntax GroupOption
syntax GroupOption
= "gs" "=" NatCon
| "op" "=" BoxOperator
;
syntax WhiteSpace
layout WhiteSpace =
WhitespaceAndComment*
!>> [\ \t\n\r]
!>> "%"
;
syntax WhitespaceAndComment
lexical WhitespaceAndComment
= [\ \t\n\r]
| "%" [!%]* "%"
| "%%" [!\n]* "\n"
;