modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/scanner/scanner.l (about)

     1  %{
     2  // Copyright 2016 The GC Authors. All rights reserved.
     3  // Use of this source code is governed by a BSD-style
     4  // license that can be found in the LICENSE file.
     5  %}
     6  
     7  /* Non ASCII character classes */
     8  eof			\x80
     9  other			\x81
    10  
    11  any_to_eol		[^\x80\n\r]*
    12  big_u_value		\\U{hex_digit}{hex_digit}{hex_digit}{hex_digit}{hex_digit}{hex_digit}{hex_digit}{hex_digit}
    13  byte_value		{octal_byte_value}|{hex_byte_value}
    14  comment			"/*"([^*\x80]|\*+[^*/\x80])*\*+\/
    15  decimal_digit		[0-9]
    16  decimal_lit		[1-9]{decimal_digit}*
    17  decimals		{decimal_digit}+
    18  escaped_char		\\[abfnrtv'\x22\\]
    19  exponent		[eE][+-]?{decimals}
    20  float_lit		{decimals}"."{decimals}?{exponent}?|{decimals}{exponent}|"."{decimals}{exponent}?
    21  hex_byte_value		\\x{hex_digit}{hex_digit}
    22  hex_digit		[0-9a-fA-F]
    23  hex_lit			0[xX]{hex_digit}+
    24  identifier		{letter}({letter}|[0-9])*
    25  imaginary_lit		({decimals}|{float_lit})"i"
    26  int_lit			{decimal_lit}|{octal_lit}|{hex_lit}
    27  interpreted_string_lit	\x22({str_unicode_value}|{byte_value})*\x22
    28  letter			[a-zA-Z_]|{other}
    29  little_u_value		\\u{hex_digit}{hex_digit}{hex_digit}{hex_digit}
    30  octal_byte_value	\\{octal_digit}{octal_digit}{octal_digit}
    31  octal_digit		[0-7]
    32  octal_lit		0{octal_digit}*
    33  raw_string_lit		`[^`\x80]*`
    34  rune_lit		'({rune_unicode_value}?|{byte_value})'
    35  rune_unicode_value	[^\x80\n\r\\]|{little_u_value}|{big_u_value}|{escaped_char}
    36  str_unicode_value	[^\x22\x80\n\r\\]|{little_u_value}|{big_u_value}|{escaped_char}
    37  string_lit		{raw_string_lit}|{interpreted_string_lit}
    38  
    39  %%
    40   
    41  [ \t\r]+
    42  "//"{any_to_eol}[\n\r\x80]
    43  "/*"([^*\x80]|\*+[^*/\x80])*\*+\/
    44  "!="
    45  "%="
    46  "&&"
    47  "&="
    48  "&^"
    49  "&^="
    50  "*="
    51  "++"
    52  "+="
    53  "--"
    54  "-="
    55  "..."
    56  "/="
    57  ":="
    58  "<-"
    59  "<<"
    60  "<<="
    61  "<="
    62  "=="
    63  ">="
    64  ">>"
    65  ">>="
    66  "^="
    67  "|="
    68  "||"
    69  "break"
    70  "case"
    71  "chan"
    72  "const"
    73  "continue"
    74  "default"
    75  "defer"
    76  "else"
    77  "fallthrough"
    78  "for"
    79  "func"
    80  "go"
    81  "goto"
    82  "if"
    83  "import"
    84  "interface"
    85  "map"
    86  "package"
    87  "range"
    88  "return"
    89  "select"
    90  "struct"
    91  "switch"
    92  "type"
    93  "var"
    94  {float_lit}
    95  {identifier}
    96  {imaginary_lit}
    97  {int_lit}
    98  {rune_lit}
    99  {string_lit}