added meta

This commit is contained in:
Jeremie Dimino 2016-11-12 11:48:24 +00:00
parent 0a29ae3749
commit 6039e16258
2 changed files with 35 additions and 0 deletions

20
src/meta.ml Normal file
View File

@ -0,0 +1,20 @@
(** META file representation *)
type t =
{ name : string
; sub : t list
; defs : def list
}
and kind = Set | Add
and def =
{ kind : kind
; var : string
; predicates : predicate list
}
and predicate =
| Pos of string
| Neg of string

15
src/meta_lexer.mll Normal file
View File

@ -0,0 +1,15 @@
{ open Meta_parser }
rule token = parse
| [' ' '\t']* { token lexbuf }
| '#' [^ '\r' '\n']* { token lexbuf }
| ("\n" | "\r\n") { Lexing.new_line lexbuf; token lexbuf }
| ['A'-'Z' 'a'-'z' '0'-'9' '_' '.']+ as s { NAME s }
| '"' ([^'"']* as s) '"' { STRING s }
| '-' { MINUS }
| '(' { LPAREN }
| ')' { RPAREN }
| ',' { COMMA }
| '=' { EQUAL }
| "+=" { PLUS_EQUAL }