Changeset 4e0168a


Ignore:
Timestamp:
Oct 13, 2024, 4:59:53 PM (5 weeks ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
02ea981
Parents:
c565d68
Message:

documentation, update C23 attribute lexing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/lex.ll

    rc565d68 r4e0168a  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Sun Oct 13 10:03:28 2024
    13  * Update Count     : 869
     12 * Last Modified On : Sun Oct 13 16:49:47 2024
     13 * Update Count     : 876
    1414 */
    1515
     
    175175                                // operator {op_unary_pre_post}|{op_binary_over}|{op_binary_not_over}
    176176
    177                                 // C23 attributes
    178 attr_string "\""[^\"]*"\""
    179 attr_arg_opt ({hv_white}*"("{hv_white}*{attr_string}{hv_white}*")")?
     177                                // C23 attributes, CPP also handles missing quote delimiter
     178attr_string "\""([^\"\\\n]|{escape_seq})*["\n]
     179attr_arg_opt ({hv_white}*"("({hv_white}*{attr_string}{hv_white}*)+")")?
    180180attributes "deprecated"{attr_arg_opt}|"fallthrough"|"nodiscard"{attr_arg_opt}|"maybe_unused"|"noreturn"|"_Noreturn"|"unsequenced"|"unused"|"reproducible"|{identifier}{hv_white}*"::"{hv_white}*{identifier}
    181181
    182182%x COMMENT
    183 %x BKQUOTE
    184183%x QUOTE
    185184%x STRING
     
    382381                                /* C23 attributes */
    383382"[["{hv_white}*{attributes}({hv_white}*","{hv_white}*{attributes})*{hv_white}*"]]" {
    384         strtext = new string( &yytext[2], yyleng - 4 );         // remove [[]]
     383        strtext = new string( &yytext[2], yyleng - 4 );         // remove delimiters "[[" and "]]"
    385384        RETURN_STR(C23_ATTRIBUTE);
    386385}
     
    396395{hex_floating_constant} { NUMERIC_RETURN(FLOATINGconstant); }
    397396
    398                                 /* character constant, allows empty value */
     397                                /* character constant, allows empty value, CPP also handles missing quote delimiter */
    399398({cwide_prefix}[_]?)?['] { BEGIN QUOTE; rm_underscore(); strtext = new string( yytext, yyleng ); }
    400399<QUOTE>[^'\\\n]* { strtext->append( yytext, yyleng ); }
     
    402401                                /* ' stop editor highlighting */
    403402
    404                                 /* string constant */
     403                                /* string constant, CPP also handles missing quote delimiter */
    405404({swide_prefix}[_]?)?["] { BEGIN STRING; rm_underscore(); strtext = new string( yytext, yyleng ); }
    406405<STRING>[^"\\\n]* { strtext->append( yytext, yyleng ); }
Note: See TracChangeset for help on using the changeset viewer.