Skip to content

Commit

Permalink
Merge pull request xapi-project#4 from djs55/add-lexer
Browse files Browse the repository at this point in the history
Re-add xl config file lexer, from xen-api history
  • Loading branch information
djs55 committed Nov 5, 2014
2 parents 9b43b06 + 304f5ee commit 9a637ec
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 209 deletions.
209 changes: 0 additions & 209 deletions src/xn_cfg_lexer.ml

This file was deleted.

18 changes: 18 additions & 0 deletions src/xn_cfg_lexer.mll
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
open Xn_cfg_parser
let unquote x = String.sub x 1 (String.length x - 2)
}
rule token = parse
['a'-'z']['_''0'-'9''a'-'z']* as x { IDENT x }
| ['0'-'9']['0'-'9''a'-'f''x']* as x { INT (int_of_string x) }
| '\''([^'\'''\n']|'.')*'\'' as x { STRING (unquote x) }
| '"'([^'"''\n']|'.')*'"' as x { STRING (unquote x) }
| ',' { COMMA }
| '[' { LBRACKET }
| ']' { RBRACKET }
| '=' { EQ }
| ';' { SEMICOLON }
| '\n'
| '#'[^'\n']*'\n' { NEWLINE }
| [' ' '\t' ] { token lexbuf }
| eof { EOF }

0 comments on commit 9a637ec

Please sign in to comment.