Permalink
Browse files

parse_sql: CE

  • Loading branch information...
pad
pad committed Sep 28, 2010
1 parent 21af166 commit 76cd4f3d575020ebf719182c9190dd0f170d183c
Showing with 9 additions and 19 deletions.
  1. +1 −2 lang_sql/parsing/Makefile
  2. +2 −3 lang_sql/parsing/ast_sql.ml
  3. +5 −13 lang_sql/parsing/lexer_sql.mll
  4. +1 −1 lang_sql/parsing/parse_sql.ml
@@ -12,10 +12,9 @@ SRC= flag_parsing_sql.ml \
parse_sql.ml \
test_parsing_sql.ml
-
SYSLIBS= str.cma unix.cma
LIBS=$(TOP)/commons/commons.cma $(TOP)/h_program-lang/lib.cma
-INCLUDEDIRS= $(TOP)/commons $(TOP/commons/lib-sexp $(TOP)/commons/lib-json \
+INCLUDEDIRS= $(TOP)/commons $(TOP)/commons/lib-sexp $(TOP)/commons/lib-json \
$(TOP)/h_program-lang
##############################################################################
@@ -1,7 +1,6 @@
(* for now we just try to parse, so no AST *)
-type info = {
- pinfo : Common.parse_info;
-}
+type info = Parse_info.info
+
@@ -29,19 +29,11 @@ open Parser_sql
exception Lexical of string
-let tok lexbuf = Lexing.lexeme lexbuf
-
-let tokinfo lexbuf = {
- Ast.pinfo = {
- Common.charpos = Lexing.lexeme_start lexbuf;
- Common.str = Lexing.lexeme lexbuf;
-
- (* info filled in a post-lexing phase, cf Parse_sql.tokens *)
- Common.line = -1;
- Common.column = -1;
- Common.file = "";
- };
-}
+let tok lexbuf =
+ Lexing.lexeme lexbuf
+let tokinfo lexbuf =
+ Parse_info.tokinfo_str_pos (Lexing.lexeme lexbuf) (Lexing.lexeme_start lexbuf)
+
let keyword_table = Common.hash_of_list [
@@ -58,7 +58,7 @@ let parse2 file =
()
with
| Parsing.Parse_error ->
- pr2 (Common.error_message file (lexbuf_to_strpos lexbuf))
+ pr2 (Parse_info.error_message file (lexbuf_to_strpos lexbuf))
)
let parse a =

0 comments on commit 76cd4f3

Please sign in to comment.