Mercurial > hg > octave-nkf
changeset 440:e27d10f2e573
[project @ 1994-05-30 03:33:37 by jwe]
author | jwe |
---|---|
date | Mon, 30 May 1994 03:33:37 +0000 |
parents | be9fcedb1715 |
children | b7187b46004f |
files | src/lex.h src/lex.l src/parse.y |
diffstat | 3 files changed, 34 insertions(+), 44 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lex.h +++ b/src/lex.h @@ -96,6 +96,10 @@ // Return transpose or start a string? extern int quote_is_transpose; +// Nonzero means we thing we are looking at the beginning of a +// function definition. +extern int beginning_of_function; + #endif /*
--- a/src/lex.l +++ b/src/lex.l @@ -20,7 +20,6 @@ */ -%x COMMENT %x NEW_MATRIX %x HELP_FCN %s TEXT_FCN @@ -57,10 +56,6 @@ #include "parse.h" #include "lex.h" -// Nonzero means we thing we are looking at the beginning of a -// function definition. -static int beginning_of_function = 0; - // Nonzero means we think we are looking at a set command. static int doing_set = 0; @@ -73,6 +68,10 @@ // Return transpose or start a string? int quote_is_transpose = 0; +// Nonzero means we thing we are looking at the beginning of a +// function definition. +int beginning_of_function = 0; + // Nonzero means that we should convert spaces to a comma inside a // matrix definition. static int convert_spaces_to_comma = 1; @@ -121,31 +120,6 @@ EXPON ([DdEe][+-]?{D}+) %% -\% | -\# { - if (beginning_of_function) - { - grab_help_text (); - beginning_of_function = 0; - } - - BEGIN COMMENT; - current_input_column += yyleng; - } - -<COMMENT>\n { - BEGIN 0; - current_input_column = 1; - quote_is_transpose = 0; - cant_be_identifier = 0; - convert_spaces_to_comma = 1; - return '\n'; - } - -<COMMENT><<EOF>> { TOK_RETURN (END_OF_INPUT); } - -<COMMENT>.*$ { current_input_column += yyleng; } - <NEW_MATRIX>[^ \t\n] { yyless (0); BEGIN MATRIX; @@ -539,6 +513,26 @@ BIN_OP_RETURN (':', 0); } +\% | +\# { + if (in_brace_or_paren.empty () && beginning_of_function) + { + grab_help_text (); + beginning_of_function = 0; + } + else + { + int c; + while ((c = yyinput ()) != EOF && c != '\n') + ; // Eat comment. + } + + current_input_column = 1; + + if (! braceflag || beginning_of_function) + return '\n'; + } + \" { BEGIN DQSTRING; } ".**" { BIN_OP_RETURN (EPOW, 0); } ".*" { BIN_OP_RETURN (EMUL, 0); } @@ -1144,9 +1138,8 @@ in_comment = 1; case ' ': case '\t': + default: break; - default: - goto done; } } @@ -1154,20 +1147,10 @@ { warning ("grab_help_text: buffer overflow after caching %d chars", max_len); - - goto done; + break; } } - done: - -// Make sure there's an end of line so yylex sees an end to the -// comment immediately. - - yyunput (c, yytext); - if (c != '\n') - yyunput ('\n', yytext); - help_buf[len] = '\0'; }