Skip to content
Snippets Groups Projects
Commit 98672e58 authored by Erwan Jahier's avatar Erwan Jahier
Browse files

forgot the lexer in the previous commit...

parent 1aab41bf
No related branches found
No related tags found
No related merge requests found
......@@ -63,6 +63,7 @@ Hashtbl.add keywords "uses" (function x -> TK_USES x) ;;
Hashtbl.add keywords "is" (function x -> TK_IS x) ;;
Hashtbl.add keywords "body" (function x -> TK_BODY x) ;;
Hashtbl.add keywords "end" (function x -> TK_END x) ;;
Hashtbl.add keywords "include" (function x -> TK_INCLUDE x) ;;
let is_a_keyword ( s: string ) = (
try
......@@ -104,6 +105,7 @@ let token_code tk = (
| TK_ICONST lxm -> ("TK_ICONT" , lxm)
| TK_IDENT lxm -> ("TK_IDENT" , lxm)
| TK_LONGIDENT lxm -> ("TK_LONGIDENT" , lxm)
| TK_STRING lxm -> ("TK_STRING" , lxm)
| TK_IF lxm -> ("TK_IF" , lxm)
| TK_IMPL lxm -> ("TK_IMPL" , lxm)
| TK_INT lxm -> ("TK_INT" , lxm)
......@@ -151,6 +153,8 @@ let token_code tk = (
| TK_IS lxm -> ("TK_IS" , lxm)
| TK_BODY lxm -> ("TK_BODY" , lxm)
| TK_END lxm -> ("TK_END" , lxm)
| TK_INCLUDE lxm -> ("TK_INCLUDE" , lxm)
(* | TK_QUOTE lxm -> ("TK_QUOTE" , lxm) *)
)
}
......@@ -217,6 +221,7 @@ rule lexer = parse
| "=" { TK_EQ ( Lxm.make lexbuf ) }
| "." { TK_DOT ( Lxm.make lexbuf ) }
(* | "\"" { TK_QUOTE ( Lxm.make lexbuf ) } *)
| "," { TK_COMA ( Lxm.make lexbuf ) }
| ";" { TK_SEMICOL ( Lxm.make lexbuf ) }
| ":" { TK_COLON ( Lxm.make lexbuf ) }
......@@ -236,6 +241,12 @@ rule lexer = parse
let lxm = Lxm.make lexbuf in
TK_LONGIDENT (lxm)
}
(* une chaine quelconque *)
| "\"" ['_' 'A'-'Z' 'a'-'z'] ['A'-'Z' '(' ')' '$' '/' 'a'-'z' '.' '-' '_'] * "\""
{
let lxm = Lxm.make_string lexbuf in
TK_STRING (lxm)
}
(* constantes entires et relles *)
| chiffres { TK_ICONST (Lxm.make lexbuf ) }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment