diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 2ef9526c95..8b61e6a0dc 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,19 @@ +2000-08-11 08:55 UTC+0100 Ryszard Glab + + *source/compiler/harbour.l + * added support for code generated by the preprocessed TEXT/ENDTEXT + NOTE: Since it is not implemented yet in harbour preprocessor + I have followed Clipper method here. Every line of TEXT/ENDTEXT + is preprocessed into + QOUT("...") + or + QOUT([...]) + with no spaces. [] string delimiters are used if any combination + of "'[] are used inside a text. + Notice that during preprocessing of normal code when [] string + delimiters are used then Clipper uses the first closing ] character + as a string terminator. + 2000-08-10 14:30 UTC-0400 David G. Holm * source/rdd/dbcmd.c diff --git a/harbour/source/compiler/harbour.l b/harbour/source/compiler/harbour.l index dae3422ecd..6bfe94e659 100644 --- a/harbour/source/compiler/harbour.l +++ b/harbour/source/compiler/harbour.l @@ -117,7 +117,7 @@ FalseValue "."[f|n]"." Separator {SpaceTab} -%x STRING1 STRING2 STRING3 +%x STRING1 STRING2 STRING3 STRING4START STRING4 %x NEXT_ BREAK_ CASE_ DO_ WHILE_ WITH_ END_ FIELD_ %x FOR_ FUNCTION_ IIF_ IF_ IN_ INIT_ %x RETURN_ RECOVER_ @@ -151,6 +151,25 @@ Separator {SpaceTab} } } +"QOUT([" { + /* preprocessed TEXT/ENDTEXT line + NOTE: Clipper preprocesses TEXT/ENDTEXT block into a series of QOUT calls + QOUT("...") + or + QOUT([...]) + [] is used if text contains any string delimiters "'[] + NOTE: Clipper allows for [[nested]] only if it is preprocessed from + TEXT/ENDTEXT block - in normal code the preprocesor uses the first + closing ] as a string terminator. + */ + BEGIN STRING4START; + unput( '(' ); + yylval.string = hb_compIdentifierNew( "QOUT", TRUE ); + hb_comp_iState = IDENTIFIER; + + return IDENTIFIER; +} + [^'\n]*\n { BEGIN 0; unput( '\n' ); yytext[--yyleng] = '\0'; @@ -202,6 +221,21 @@ Separator {SpaceTab} return LITERAL; } +\( { BEGIN STRING4; return( '(' ); } +. { BEGIN 0; unput( yytext[ yyleng-1 ] ); } + +.*\]\)\n { BEGIN 0; + unput( '\n' ); + unput( ')' ); + yyleng -= 3; + yytext[ yyleng ] = '\0'; + yylval.string = hb_compIdentifierNew( yytext, TRUE ); + hb_comp_iState = LITERAL; + + return LITERAL; + } +. { BEGIN STRING3; unput( yytext[ yyleng-1 ] ); } + {SpaceTab} ; \n {