summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Grammar/Lexer.x
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2014-03-21 21:25:05 +0000
committerkr.angelov <kr.angelov@gmail.com>2014-03-21 21:25:05 +0000
commit51a9ef72c7e32f06d2413a5aea5751df2780063b (patch)
treedc7a0626ade80e5d5c621d9eb381ebaf8d15f50c /src/compiler/GF/Grammar/Lexer.x
parentd816c34986d3ecb4624d7638e290adddc941b38d (diff)
refactor the compilation of CFG and EBNF grammars. Now they are parsed by using GF.Grammar.Parser just like the ordinary GF grammars. Furthermore now GF.Speech.CFG is moved to GF.Grammar.CFG. The new module is used by both the speech conversion utils and by the compiler for CFG grammars. The parser for CFG now consumes a lot less memory and can be used with grammars with more than 4 000 000 productions.
Diffstat (limited to 'src/compiler/GF/Grammar/Lexer.x')
-rw-r--r--src/compiler/GF/Grammar/Lexer.x5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/compiler/GF/Grammar/Lexer.x b/src/compiler/GF/Grammar/Lexer.x
index c4f7159a2..0293d3915 100644
--- a/src/compiler/GF/Grammar/Lexer.x
+++ b/src/compiler/GF/Grammar/Lexer.x
@@ -26,7 +26,7 @@ $i = [$l $d _ '] -- identifier character
$u = [.\n] -- universal: any character
@rsyms = -- symbols and non-identifier-like reserved words
- \; | \= | \{ | \} | \( | \) | \~ | \* \* | \: | \- \> | \, | \[ | \] | \- | \. | \| | \% | \? | \< | \> | \@ | \# | \! | \* | \+ | \+ \+ | \\ | \\\\ | \= \> | \_ | \$ | \/
+ \; | \= | \{ | \} | \( | \) | \~ | \* \* | \: | \- \> | \, | \[ | \] | \- | \. | \| | \% | \? | \< | \> | \@ | \# | \! | \* | \+ | \+ \+ | \\ | \\\\ | \= \> | \_ | \$ | \/ | \: \= | \: \: \=
:-
"--" [.]* ; -- Toss single line comments
@@ -83,6 +83,7 @@ data Token
| T_ccurly
| T_underscore
| T_at
+ | T_cfarrow
| T_PType
| T_Str
| T_Strs
@@ -169,6 +170,8 @@ resWords = Map.fromList
, b "|" T_bar
, b "_" T_underscore
, b "@" T_at
+ , b "::=" T_cfarrow
+ , b ":=" T_cfarrow
, b "PType" T_PType
, b "Str" T_Str
, b "Strs" T_Strs