X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=helm%2Focaml%2Fcic_disambiguation%2FcicTextualLexer2.ml;h=b28d3cae66de76a40b49725bdc829024dbcce848;hb=c0f566c371cefef7666a6d68dd1b6c38ca6918ce;hp=650b6972375f76c5c49885cfd51efdb05a3b8a5b;hpb=0575a1cb077087970f311b48f2e45dc4a01a6867;p=helm.git diff --git a/helm/ocaml/cic_disambiguation/cicTextualLexer2.ml b/helm/ocaml/cic_disambiguation/cicTextualLexer2.ml index 650b69723..b28d3cae6 100644 --- a/helm/ocaml/cic_disambiguation/cicTextualLexer2.ml +++ b/helm/ocaml/cic_disambiguation/cicTextualLexer2.ml @@ -32,17 +32,24 @@ let regexp digit = [ '0' - '9' ] let regexp blank = [ ' ' '\t' '\n' ] let regexp paren = [ '(' '[' '{' ')' ']' '}' ] let regexp implicit = '?' +let regexp placeholder = '%' let regexp symbol_char = [^ 'a' - 'z' 'A' - 'Z' '0' - '9' ' ' '\t' '\n' '\\' '(' '[' '{' ')' ']' '}' '?' ] -let regexp comment_char = [^ '\n' ] -let regexp comment = "%%" comment_char* +let regexp dust = "%%" [^ '\n']* '\n' + +let regexp comment_char = [^ ")" ] +let regexp note = "(*" comment_char* "*)" + +let regexp commentbegin = "(**" +let regexp commentend = "**)" + let regexp blanks = blank+ let regexp num = digit+ let regexp tex_token = '\\' alpha+ -let regexp symbol = symbol_char+ +let regexp symbol = symbol_char let regexp ident_cont = alpha | num | '_' | '\'' let regexp ident_cont' = ident_cont | tex_token let regexp ident = (alpha ident_cont*) | ('_' ident_cont+) @@ -121,6 +128,7 @@ let rec token comments = lexer | paren -> return lexbuf ("PAREN", Ulexing.utf8_lexeme lexbuf) | meta -> return lexbuf ("META", Ulexing.utf8_lexeme lexbuf) | implicit -> return lexbuf ("IMPLICIT", Ulexing.utf8_lexeme lexbuf) + | placeholder -> return lexbuf ("PLACEHOLDER", Ulexing.utf8_lexeme lexbuf) | qstring -> return lexbuf ("QSTRING", remove_quotes (Ulexing.utf8_lexeme lexbuf)) | symbol -> return lexbuf ("SYMBOL", Ulexing.utf8_lexeme lexbuf) @@ -132,14 +140,17 @@ let rec token comments = lexer return lexbuf ("SYMBOL", Utf8Macro.expand macro) with Utf8Macro.Macro_not_found _ -> return lexbuf ("SYMBOL", Ulexing.utf8_lexeme lexbuf)) - | comment -> - if comments then + | dust -> token comments lexbuf + | note -> + (*if comments then*) let comment = Ulexing.utf8_sub_lexeme lexbuf 2 (Ulexing.lexeme_length lexbuf - 2) in - return lexbuf ("COMMENT", comment) - else - token comments lexbuf + return lexbuf ("NOTE", comment) + (*else + token comments lexbuf*) + | commentbegin -> return lexbuf ("BEGINCOMMENT","") + | commentend -> return lexbuf ("ENDCOMMENT","") | eof -> return lexbuf ("EOI", "") | _ -> error lexbuf "Invalid character"