aboutsummaryrefslogtreecommitdiff
path: root/expressionLexer.mll
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@chimrod.com>2017-11-24 09:22:24 +0100
committerSébastien Dailly <sebastien@chimrod.com>2017-11-24 09:23:38 +0100
commita6b5a6bdd138a5ccc6827bcc73580df1e9218820 (patch)
treeff577395c1a5951a61a7234322f927f6ead5ee29 /expressionLexer.mll
parentecb6fd62c275af03a07d892313ab3914d81cd40e (diff)
Moved all the code to src directory
Diffstat (limited to 'expressionLexer.mll')
-rwxr-xr-xexpressionLexer.mll84
1 files changed, 0 insertions, 84 deletions
diff --git a/expressionLexer.mll b/expressionLexer.mll
deleted file mode 100755
index 2d2f87e..0000000
--- a/expressionLexer.mll
+++ /dev/null
@@ -1,84 +0,0 @@
-{
- open ExpressionParser
- open Lexing
-
- exception SyntaxError of string
-}
-
-let digit = ['0'-'9']
-let real = digit+ '.'? | digit* '.' digit+
-
-
-let newline = "\r\n" | '\n' | '\r'
-let space = ['\t' ' '] | newline
-
-let letters = ['A'-'Z' 'a'-'z']
-
-let text = letters | digit
-
-let cell = letters+ digit+
-
-rule read = parse
- | space+ { read lexbuf }
-
- | digit+ as _1 { NUM _1}
- | real as _1 { REAL(Tools.String.filter_float _1)}
- | '$' { DOLLAR }
-
- | '=' { EQ }
- | "<>" { NEQ }
- | '<' { LT }
- | "<=" { LE }
- | '>' { GT }
- | ">=" { GE }
- | '*' { TIMES }
- | '+' { PLUS }
- | '-' { MINUS }
- | '/' { DIVIDE }
- | '"' { read_string (Buffer.create 17) lexbuf }
- | ';' { SEMICOLON }
- | ':' { COLON }
- | '(' { LPAREN }
- | ')' { RPAREN }
- | '^' { POW }
-
- | letters+ as _1 { LETTERS _1}
-
- | '\000' { EOF }
- | eof { EOF }
-
-and read_string buf = parse
- | '"' { STR (Buffer.contents buf) }
- | '\\' '/' { Buffer.add_char buf '/'; read_string buf lexbuf }
- | '\\' '\\' { Buffer.add_char buf '\\'; read_string buf lexbuf }
- | '\\' 'b' { Buffer.add_char buf '\b'; read_string buf lexbuf }
- | '\\' 'f' { Buffer.add_char buf '\012'; read_string buf lexbuf }
- | '\\' 'n' { Buffer.add_char buf '\n'; read_string buf lexbuf }
- | '\\' 'r' { Buffer.add_char buf '\r'; read_string buf lexbuf }
- | '\\' 't' { Buffer.add_char buf '\t'; read_string buf lexbuf }
- | '\\' '"' { Buffer.add_char buf '"'; read_string buf lexbuf }
- | [^ '"' '\\' '\000']+
- { Buffer.add_string buf (Lexing.lexeme lexbuf);
- read_string buf lexbuf
- }
- | '\000' { STR (Buffer.contents buf) }
- | _ { raise (SyntaxError ("Illegal string character: " ^ Lexing.lexeme lexbuf)) }
- | eof { STR ( Buffer.contents buf) }
-
-and quoteless_string buf = parse
- | '\\' '/' { Buffer.add_char buf '/'; quoteless_string buf lexbuf }
- | '\\' '\\' { Buffer.add_char buf '\\'; quoteless_string buf lexbuf }
- | '\\' 'b' { Buffer.add_char buf '\b'; quoteless_string buf lexbuf }
- | '\\' 'f' { Buffer.add_char buf '\012'; quoteless_string buf lexbuf }
- | '\\' 'n' { Buffer.add_char buf '\n'; quoteless_string buf lexbuf }
- | '\\' 'r' { Buffer.add_char buf '\r'; quoteless_string buf lexbuf }
- | '\\' 't' { Buffer.add_char buf '\t'; quoteless_string buf lexbuf }
- | '\\' '"' { Buffer.add_char buf '"'; quoteless_string buf lexbuf }
- | [^ '\\' '\000']+
- { Buffer.add_string buf (Lexing.lexeme lexbuf);
- quoteless_string buf lexbuf
- }
- | '\000' { STR (Buffer.contents buf) }
- | _ { raise (SyntaxError ("Illegal string character: " ^ Lexing.lexeme lexbuf)) }
- | eof { STR (Buffer.contents buf) }
-