From: Enrico Tassi Date: Mon, 16 May 2005 15:20:34 +0000 (+0000) Subject: added comments X-Git-Tag: single_binding~60 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=63b1ff9601a54dba2bed63c2b58ec909dc162471;p=helm.git added comments --- diff --git a/helm/ocaml/cic_disambiguation/cicTextualLexer2.ml b/helm/ocaml/cic_disambiguation/cicTextualLexer2.ml index 650b69723..4cf0e4270 100644 --- a/helm/ocaml/cic_disambiguation/cicTextualLexer2.ml +++ b/helm/ocaml/cic_disambiguation/cicTextualLexer2.ml @@ -37,8 +37,11 @@ let regexp symbol_char = ' ' '\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+ @@ -132,14 +135,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" diff --git a/helm/ocaml/cic_disambiguation/cicTextualParser2.ml b/helm/ocaml/cic_disambiguation/cicTextualParser2.ml index 486c26a74..9b0617bc8 100644 --- a/helm/ocaml/cic_disambiguation/cicTextualParser2.ml +++ b/helm/ocaml/cic_disambiguation/cicTextualParser2.ml @@ -484,8 +484,10 @@ EXTEND | [ IDENT "check" ]; t = term -> TacticAst.Check (loc, t) | [ IDENT "hint" ] -> TacticAst.Hint loc - | [ IDENT "pmatch" ] ; t = term -> TacticAst.Match (loc,t) - | [ IDENT "instance" ] ; t = term -> TacticAst.Instance (loc,t) + | [ IDENT "whelp"; "match" ] ; t = term -> + TacticAst.Match (loc,t) + | [ IDENT "whelp"; IDENT "instance" ] ; t = term -> + TacticAst.Instance (loc,t) | [ IDENT "print" ]; name = QSTRING -> TacticAst.Print (loc, name) ]]; @@ -563,12 +565,26 @@ EXTEND TacticAst.Alias (loc, spec) ]]; - statement: [ + executable: [ [ cmd = command; SYMBOL "." -> TacticAst.Command (loc, cmd) | tac = tactical; SYMBOL "." -> TacticAst.Tactical (loc, tac) | mac = macro; SYMBOL "." -> TacticAst.Macro (loc, mac) ] ]; + + comment: [ + [ BEGINCOMMENT ; ex = executable ; ENDCOMMENT -> + TacticAst.Code (loc, ex) + | str = NOTE -> + TacticAst.Note (loc, str) + ] + ]; + + statement: [ + [ ex = executable -> TacticAst.Executable (loc,ex) + | com = comment -> TacticAst.Comment (loc, com) + ] + ]; END let exc_located_wrapper f =