diff --git a/.checkpatch.conf b/.checkpatch.conf index 3cd6a860530e..971cf6ba56db 100644 --- a/.checkpatch.conf +++ b/.checkpatch.conf @@ -49,4 +49,5 @@ --exclude doc/nrf/.*/.*/.*/images --exclude doc/nrf/.*/.*/.*/.*/images --exclude applications/nrf5340_audio/src/utils/macros +--exclude lib/at_parser/generated --exclude lib/bin/lwm2m_carrier/include diff --git a/lib/at_parser/CMakeLists.txt b/lib/at_parser/CMakeLists.txt index 0c519da83477..3b3fb7d02fc0 100644 --- a/lib/at_parser/CMakeLists.txt +++ b/lib/at_parser/CMakeLists.txt @@ -7,7 +7,7 @@ zephyr_library() zephyr_library_sources( at_parser.c - at_match.c + generated/at_match.c ) zephyr_include_directories(include) diff --git a/lib/at_parser/at_match.re b/lib/at_parser/at_match.re index 0de4c8d590ee..9120f61737f6 100644 --- a/lib/at_parser/at_match.re +++ b/lib/at_parser/at_match.re @@ -4,87 +4,82 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ -/* at_match.c generated by re2c 3.0 +/* at_match.c generated by re2c 3.0-1 * * Generated with: - * re2c at_match.re -o at_match.c -W --no-debug-info --tags - * - * Reformatted with: - * clang-format-15 -i at_match.c - * Using the following additional .clangformat options: - * IndentGotoLabels: false - * SpaceBeforeInheritanceColon: False + * re2c at_match.re -o generated/at_match.c -W --tags --no-debug-info --no-generation-date \ + * --no-version */ -#include "at_match.h" +#include "../at_match.h" struct at_token at_match_cmd(const char *at, const char **remainder) { const char *cursor = at; const char *marker = NULL; - /*!local:re2c - re2c:define:YYCTYPE = "unsigned char"; - re2c:define:YYCURSOR = cursor; - re2c:define:YYMARKER = marker; - re2c:yyfill:enable = 0; - - AT_CASE_INS = [Aa][Tt]; - CMD = [#%+][A-Za-z0-9]+; - - cmd_test = AT_CASE_INS CMD "=?"; - cmd_read = AT_CASE_INS CMD "?"; - cmd_set = AT_CASE_INS CMD "="; - cmd_set_no_subparams = AT_CASE_INS CMD?; - notif = CMD ":"; - - * { return (struct at_token){ .type = AT_TOKEN_TYPE_INVALID }; } - - cmd_test - { - if (remainder) *remainder = cursor; - return (struct at_token){ - .start = at, .len = cursor - at - 2, - .type = AT_TOKEN_TYPE_CMD_TEST - }; - } - - cmd_read - { - if (remainder) *remainder = cursor; - return (struct at_token){ - .start = at, .len = cursor - at - 1, - .type = AT_TOKEN_TYPE_CMD_READ - }; - } - - cmd_set - { - if (remainder) *remainder = cursor; - return (struct at_token){ - .start = at, .len = cursor - at - 1, - .type = AT_TOKEN_TYPE_CMD_SET - }; - } - - cmd_set_no_subparams - { - if (remainder) *remainder = cursor; - return (struct at_token){ - .start = at, .len = cursor - at, - .type = AT_TOKEN_TYPE_CMD_SET - }; - } - - notif - { - if (remainder) *remainder = cursor; - return (struct at_token){ - .start = at, .len = cursor - at - 1, - .type = AT_TOKEN_TYPE_NOTIF - }; - } - */ +/*!local:re2c + re2c:define:YYCTYPE = "unsigned char"; + re2c:define:YYCURSOR = cursor; + re2c:define:YYMARKER = marker; + re2c:yyfill:enable = 0; + + AT_CASE_INS = [Aa][Tt]; + CMD = [#%+][A-Za-z0-9]+; + + cmd_test = AT_CASE_INS CMD "=?"; + cmd_read = AT_CASE_INS CMD "?"; + cmd_set = AT_CASE_INS CMD "="; + cmd_set_no_subparams = AT_CASE_INS CMD?; + notif = CMD ":"; + + * { return (struct at_token){ .type = AT_TOKEN_TYPE_INVALID }; } + + cmd_test + { + if (remainder) *remainder = cursor; + return (struct at_token){ + .start = at, .len = cursor - at - 2, + .type = AT_TOKEN_TYPE_CMD_TEST + }; + } + + cmd_read + { + if (remainder) *remainder = cursor; + return (struct at_token){ + .start = at, .len = cursor - at - 1, + .type = AT_TOKEN_TYPE_CMD_READ + }; + } + + cmd_set + { + if (remainder) *remainder = cursor; + return (struct at_token){ + .start = at, .len = cursor - at - 1, + .type = AT_TOKEN_TYPE_CMD_SET + }; + } + + cmd_set_no_subparams + { + if (remainder) *remainder = cursor; + return (struct at_token){ + .start = at, .len = cursor - at, + .type = AT_TOKEN_TYPE_CMD_SET + }; + } + + notif + { + if (remainder) *remainder = cursor; + return (struct at_token){ + .start = at, .len = cursor - at - 1, + .type = AT_TOKEN_TYPE_NOTIF + }; + } +*/ } struct at_token at_match_subparam(const char *at, const char **remainder) @@ -94,75 +89,75 @@ struct at_token at_match_subparam(const char *at, const char **remainder) const char *t1; const char *t2; - /*!stags:re2c format = 'const char *@@;\n'; */ - - /*!local:re2c - re2c:define:YYCTYPE = "unsigned char"; - re2c:define:YYCURSOR = cursor; - re2c:define:YYMARKER = marker; - re2c:yyfill:enable = 0; - - SPACE = " "; - INT = "0"|[+\-]?[1-9][0-9]*; - COMMA = ","; - QUOTE = "\""; - QUOTED_STR = QUOTE @t1 [^"\x00]* @t2 QUOTE; - OPEN_PAR = "("; - CLOSE_PAR = ")"; - ARRAY = OPEN_PAR [^()\x00]+ CLOSE_PAR; - - int = SPACE? @t1 INT @t2 COMMA?; - quoted_str = SPACE? QUOTED_STR COMMA?; - array = SPACE? @t1 ARRAY @t2 COMMA?; - empty = SPACE? @t1 @t2 COMMA; - - * { return (struct at_token){ .type = AT_TOKEN_TYPE_INVALID }; } - - int - { - char last = *(cursor - 1); - - if (remainder) *remainder = cursor; - return (struct at_token){ - .start = t1, .len = t2 - t1, - .type = AT_TOKEN_TYPE_INT, - .var = last == ',' ? AT_TOKEN_VAR_COMMA : AT_TOKEN_VAR_NO_COMMA - }; - } - - quoted_str - { - char last = *(cursor - 1); - - if (remainder) *remainder = cursor; - return (struct at_token){ - .start = t1, .len = t2 - t1, - .type = AT_TOKEN_TYPE_QUOTED_STRING, - .var = last == ',' ? AT_TOKEN_VAR_COMMA : AT_TOKEN_VAR_NO_COMMA - }; - } - - array - { - char last = *(cursor - 1); - - if (remainder) *remainder = cursor; - return (struct at_token){ - .start = t1, .len = t2 - t1, - .type = AT_TOKEN_TYPE_ARRAY, - .var = last == ',' ? AT_TOKEN_VAR_COMMA : AT_TOKEN_VAR_NO_COMMA - }; - } - - empty - { - if (remainder) *remainder = cursor; - return (struct at_token){ - .start = t1, .len = t2 - t1, - .type = AT_TOKEN_TYPE_EMPTY, .var = AT_TOKEN_VAR_COMMA - }; - } - */ +/*!stags:re2c format = 'const char *@@;'; */ + +/*!local:re2c + re2c:define:YYCTYPE = "unsigned char"; + re2c:define:YYCURSOR = cursor; + re2c:define:YYMARKER = marker; + re2c:yyfill:enable = 0; + + SPACE = " "; + INT = "0"|[+\-]?[1-9][0-9]*; + COMMA = ","; + QUOTE = "\""; + QUOTED_STR = QUOTE @t1 [^"\x00]* @t2 QUOTE; + OPEN_PAR = "("; + CLOSE_PAR = ")"; + ARRAY = OPEN_PAR [^()\x00]+ CLOSE_PAR; + + int = SPACE? @t1 INT @t2 COMMA?; + quoted_str = SPACE? QUOTED_STR COMMA?; + array = SPACE? @t1 ARRAY @t2 COMMA?; + empty = SPACE? @t1 @t2 COMMA; + + * { return (struct at_token){ .type = AT_TOKEN_TYPE_INVALID }; } + + int + { + char last = *(cursor - 1); + + if (remainder) *remainder = cursor; + return (struct at_token){ + .start = t1, .len = t2 - t1, + .type = AT_TOKEN_TYPE_INT, + .var = last == ',' ? AT_TOKEN_VAR_COMMA : AT_TOKEN_VAR_NO_COMMA + }; + } + + quoted_str + { + char last = *(cursor - 1); + + if (remainder) *remainder = cursor; + return (struct at_token){ + .start = t1, .len = t2 - t1, + .type = AT_TOKEN_TYPE_QUOTED_STRING, + .var = last == ',' ? AT_TOKEN_VAR_COMMA : AT_TOKEN_VAR_NO_COMMA + }; + } + + array + { + char last = *(cursor - 1); + + if (remainder) *remainder = cursor; + return (struct at_token){ + .start = t1, .len = t2 - t1, + .type = AT_TOKEN_TYPE_ARRAY, + .var = last == ',' ? AT_TOKEN_VAR_COMMA : AT_TOKEN_VAR_NO_COMMA + }; + } + + empty + { + if (remainder) *remainder = cursor; + return (struct at_token){ + .start = t1, .len = t2 - t1, + .type = AT_TOKEN_TYPE_EMPTY, .var = AT_TOKEN_VAR_COMMA + }; + } +*/ } struct at_token at_match_str(const char *at, const char **remainder) @@ -172,29 +167,29 @@ struct at_token at_match_str(const char *at, const char **remainder) const char *t1; const char *t2; - /*!stags:re2c format = 'const char *@@;\n'; */ +/*!stags:re2c format = 'const char *@@;'; */ - /*!local:re2c - re2c:define:YYCTYPE = "unsigned char"; - re2c:define:YYCURSOR = cursor; - re2c:define:YYMARKER = marker; - re2c:yyfill:enable = 0; +/*!local:re2c + re2c:define:YYCTYPE = "unsigned char"; + re2c:define:YYCURSOR = cursor; + re2c:define:YYMARKER = marker; + re2c:yyfill:enable = 0; - SPACE = " "; - CRLF = "\r\n"; - STR = [A-Za-z0-9][A-Za-z_\-.0-9 ]*; + SPACE = " "; + CRLF = "\r\n"; + STR = [A-Za-z0-9][A-Za-z_\-.0-9 ]*; - str = SPACE? @t1 STR @t2 CRLF?; + str = SPACE? @t1 STR @t2 CRLF?; - * { return (struct at_token){ .type = AT_TOKEN_TYPE_INVALID }; } + * { return (struct at_token){ .type = AT_TOKEN_TYPE_INVALID }; } - str - { - if (remainder) *remainder = t2; - return (struct at_token){ - .start = t1, .len = t2 - t1, - .type = AT_TOKEN_TYPE_STRING, - }; - } - */ + str + { + if (remainder) *remainder = t2; + return (struct at_token){ + .start = t1, .len = t2 - t1, + .type = AT_TOKEN_TYPE_STRING, + }; + } +*/ } diff --git a/lib/at_parser/at_match.c b/lib/at_parser/generated/at_match.c similarity index 56% rename from lib/at_parser/at_match.c rename to lib/at_parser/generated/at_match.c index 5a4c387ad7e2..dd48dc01f7ff 100644 --- a/lib/at_parser/at_match.c +++ b/lib/at_parser/generated/at_match.c @@ -1,53 +1,45 @@ +/* Generated by re2c */ /* * Copyright (c) 2024 Nordic Semiconductor ASA * * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ -/* at_match.c generated by re2c 3.0 +/* at_match.c generated by re2c 3.0-1 * * Generated with: - * re2c at_match.re -o at_match.c -W --no-debug-info --tags - * - * Reformatted with: - * clang-format-15 -i at_match.c - * Using the following additional .clangformat options: - * IndentGotoLabels: false - * SpaceBeforeInheritanceColon: False + * re2c at_match.re -o generated/at_match.c -W --tags --no-debug-info --no-generation-date \ + * --no-version */ -#include "at_match.h" +#include "../at_match.h" struct at_token at_match_cmd(const char *at, const char **remainder) { const char *cursor = at; const char *marker = NULL; - { - unsigned char yych; - unsigned int yyaccept = 0; - yych = *cursor; - switch (yych) { +{ + unsigned char yych; + unsigned int yyaccept = 0; + yych = *cursor; + switch (yych) { case '#': case '%': - case '+': - goto yy3; + case '+': goto yy3; case 'A': - case 'a': - goto yy4; - default: - goto yy1; - } + case 'a': goto yy4; + default: goto yy1; + } yy1: - ++cursor; -yy2: { - return (struct at_token){.type = AT_TOKEN_TYPE_INVALID}; -} + ++cursor; +yy2: + { return (struct at_token){ .type = AT_TOKEN_TYPE_INVALID }; } yy3: - yyaccept = 0; - yych = *(marker = ++cursor); - switch (yych) { + yyaccept = 0; + yych = *(marker = ++cursor); + switch (yych) { case '0': case '1': case '2': @@ -109,23 +101,19 @@ yy2: { case 'w': case 'x': case 'y': - case 'z': - goto yy5; - default: - goto yy2; - } + case 'z': goto yy5; + default: goto yy2; + } yy4: - yych = *++cursor; - switch (yych) { + yych = *++cursor; + switch (yych) { case 'T': - case 't': - goto yy7; - default: - goto yy2; - } + case 't': goto yy7; + default: goto yy2; + } yy5: - yych = *++cursor; - switch (yych) { + yych = *++cursor; + switch (yych) { case '0': case '1': case '2': @@ -187,49 +175,46 @@ yy2: { case 'w': case 'x': case 'y': - case 'z': - goto yy5; - case ':': - goto yy9; - default: - goto yy6; - } + case 'z': goto yy5; + case ':': goto yy9; + default: goto yy6; + } yy6: - cursor = marker; - if (yyaccept == 0) { - goto yy2; - } else { - goto yy8; - } + cursor = marker; + if (yyaccept == 0) { + goto yy2; + } else { + goto yy8; + } yy7: - yyaccept = 1; - yych = *(marker = ++cursor); - switch (yych) { + yyaccept = 1; + yych = *(marker = ++cursor); + switch (yych) { case '#': case '%': - case '+': - goto yy10; - default: - goto yy8; - } -yy8: { - if (remainder) { - *remainder = cursor; + case '+': goto yy10; + default: goto yy8; + } +yy8: + { + if (remainder) *remainder = cursor; + return (struct at_token){ + .start = at, .len = cursor - at, + .type = AT_TOKEN_TYPE_CMD_SET + }; } - return (struct at_token){.start = at, .len = cursor - at, .type = AT_TOKEN_TYPE_CMD_SET}; -} yy9: - ++cursor; - { - if (remainder) { - *remainder = cursor; - } - return (struct at_token){ - .start = at, .len = cursor - at - 1, .type = AT_TOKEN_TYPE_NOTIF}; - } + ++cursor; + { + if (remainder) *remainder = cursor; + return (struct at_token){ + .start = at, .len = cursor - at - 1, + .type = AT_TOKEN_TYPE_NOTIF + }; + } yy10: - yych = *++cursor; - switch (yych) { + yych = *++cursor; + switch (yych) { case '0': case '1': case '2': @@ -291,14 +276,12 @@ yy8: { case 'w': case 'x': case 'y': - case 'z': - goto yy11; - default: - goto yy6; - } + case 'z': goto yy11; + default: goto yy6; + } yy11: - yych = *++cursor; - switch (yych) { + yych = *++cursor; + switch (yych) { case '0': case '1': case '2': @@ -360,53 +343,47 @@ yy8: { case 'w': case 'x': case 'y': - case 'z': - goto yy11; - case '=': - goto yy12; - case '?': - goto yy14; - default: - goto yy8; - } + case 'z': goto yy11; + case '=': goto yy12; + case '?': goto yy14; + default: goto yy8; + } yy12: - yych = *++cursor; - switch (yych) { - case '?': - goto yy15; - default: - goto yy13; - } -yy13: { - if (remainder) { - *remainder = cursor; - } - return (struct at_token){ - .start = at, .len = cursor - at - 1, .type = AT_TOKEN_TYPE_CMD_SET}; -} + yych = *++cursor; + switch (yych) { + case '?': goto yy15; + default: goto yy13; + } +yy13: + { + if (remainder) *remainder = cursor; + return (struct at_token){ + .start = at, .len = cursor - at - 1, + .type = AT_TOKEN_TYPE_CMD_SET + }; + } yy14: - ++cursor; - { - if (remainder) { - *remainder = cursor; - } - return (struct at_token){.start = at, - .len = cursor - at - 1, - .type = AT_TOKEN_TYPE_CMD_READ}; - } + ++cursor; + { + if (remainder) *remainder = cursor; + return (struct at_token){ + .start = at, .len = cursor - at - 1, + .type = AT_TOKEN_TYPE_CMD_READ + }; + } yy15: - ++cursor; - { - if (remainder) { - *remainder = cursor; - } - return (struct at_token){.start = at, - .len = cursor - at - 2, - .type = AT_TOKEN_TYPE_CMD_TEST}; - } + ++cursor; + { + if (remainder) *remainder = cursor; + return (struct at_token){ + .start = at, .len = cursor - at - 2, + .type = AT_TOKEN_TYPE_CMD_TEST + }; } } +} + struct at_token at_match_subparam(const char *at, const char **remainder) { const char *cursor = at; @@ -414,18 +391,15 @@ struct at_token at_match_subparam(const char *at, const char **remainder) const char *t1; const char *t2; - const char *yyt1; - const char *yyt2; +const char *yyt1;const char *yyt2; - { - unsigned char yych; - yych = *cursor; - switch (yych) { - case ' ': - goto yy19; - case '"': - goto yy20; +{ + unsigned char yych; + yych = *cursor; + switch (yych) { + case ' ': goto yy19; + case '"': goto yy20; case '(': yyt2 = cursor; goto yy21; @@ -433,8 +407,7 @@ struct at_token at_match_subparam(const char *at, const char **remainder) case '-': yyt2 = cursor; goto yy22; - case ',': - goto yy23; + case ',': goto yy23; case '0': yyt2 = cursor; goto yy24; @@ -449,19 +422,16 @@ struct at_token at_match_subparam(const char *at, const char **remainder) case '9': yyt2 = cursor; goto yy26; - default: - goto yy17; - } + default: goto yy17; + } yy17: - ++cursor; -yy18: { - return (struct at_token){.type = AT_TOKEN_TYPE_INVALID}; -} + ++cursor; +yy18: + { return (struct at_token){ .type = AT_TOKEN_TYPE_INVALID }; } yy19: - yych = *(marker = ++cursor); - switch (yych) { - case '"': - goto yy27; + yych = *(marker = ++cursor); + switch (yych) { + case '"': goto yy27; case '(': yyt2 = cursor; goto yy29; @@ -469,8 +439,7 @@ yy18: { case '-': yyt2 = cursor; goto yy30; - case ',': - goto yy23; + case ',': goto yy23; case '0': yyt2 = cursor; goto yy24; @@ -485,34 +454,30 @@ yy18: { case '9': yyt2 = cursor; goto yy26; - default: - goto yy18; - } + default: goto yy18; + } yy20: - yych = *(marker = ++cursor); - switch (yych) { - case 0x00: - goto yy18; + yych = *(marker = ++cursor); + switch (yych) { + case 0x00: goto yy18; case '"': yyt1 = yyt2 = cursor; goto yy32; default: yyt1 = cursor; goto yy31; - } + } yy21: - yych = *(marker = ++cursor); - switch (yych) { + yych = *(marker = ++cursor); + switch (yych) { case 0x00: case '(': - case ')': - goto yy18; - default: - goto yy34; - } + case ')': goto yy18; + default: goto yy34; + } yy22: - yych = *++cursor; - switch (yych) { + yych = *++cursor; + switch (yych) { case '1': case '2': case '3': @@ -521,51 +486,43 @@ yy18: { case '6': case '7': case '8': - case '9': - goto yy26; - default: - goto yy18; - } + case '9': goto yy26; + default: goto yy18; + } yy23: - ++cursor; - t1 = cursor - 1; - t2 = cursor - 1; - { - if (remainder) { - *remainder = cursor; - } - return (struct at_token){.start = t1, - .len = t2 - t1, - .type = AT_TOKEN_TYPE_EMPTY, - .var = AT_TOKEN_VAR_COMMA}; - } + ++cursor; + t1 = cursor - 1; + t2 = cursor - 1; + { + if (remainder) *remainder = cursor; + return (struct at_token){ + .start = t1, .len = t2 - t1, + .type = AT_TOKEN_TYPE_EMPTY, .var = AT_TOKEN_VAR_COMMA + }; + } yy24: - yych = *++cursor; - yyt1 = cursor; - switch (yych) { - case ',': - goto yy36; - default: - goto yy25; - } + yych = *++cursor; + yyt1 = cursor; + switch (yych) { + case ',': goto yy36; + default: goto yy25; + } yy25: - t1 = yyt2; - t2 = yyt1; - { - char last = *(cursor - 1); + t1 = yyt2; + t2 = yyt1; + { + char last = *(cursor - 1); - if (remainder) { - *remainder = cursor; - } - return (struct at_token){.start = t1, - .len = t2 - t1, - .type = AT_TOKEN_TYPE_INT, - .var = last == ',' ? AT_TOKEN_VAR_COMMA - : AT_TOKEN_VAR_NO_COMMA}; - } + if (remainder) *remainder = cursor; + return (struct at_token){ + .start = t1, .len = t2 - t1, + .type = AT_TOKEN_TYPE_INT, + .var = last == ',' ? AT_TOKEN_VAR_COMMA : AT_TOKEN_VAR_NO_COMMA + }; + } yy26: - yych = *++cursor; - switch (yych) { + yych = *++cursor; + switch (yych) { case ',': yyt1 = cursor; goto yy36; @@ -578,38 +535,34 @@ yy18: { case '6': case '7': case '8': - case '9': - goto yy26; + case '9': goto yy26; default: yyt1 = cursor; goto yy25; - } + } yy27: - yych = *++cursor; - switch (yych) { - case 0x00: - goto yy28; + yych = *++cursor; + switch (yych) { + case 0x00: goto yy28; case '"': yyt1 = yyt2 = cursor; goto yy32; default: yyt1 = cursor; goto yy31; - } + } yy28: - cursor = marker; - goto yy18; + cursor = marker; + goto yy18; yy29: - yych = *++cursor; - switch (yych) { - case ')': - goto yy28; - default: - goto yy35; - } + yych = *++cursor; + switch (yych) { + case ')': goto yy28; + default: goto yy35; + } yy30: - yych = *++cursor; - switch (yych) { + yych = *++cursor; + switch (yych) { case '1': case '2': case '3': @@ -618,91 +571,77 @@ yy18: { case '6': case '7': case '8': - case '9': - goto yy26; - default: - goto yy28; - } + case '9': goto yy26; + default: goto yy28; + } yy31: - yych = *++cursor; - switch (yych) { - case 0x00: - goto yy28; + yych = *++cursor; + switch (yych) { + case 0x00: goto yy28; case '"': yyt2 = cursor; goto yy32; - default: - goto yy31; - } + default: goto yy31; + } yy32: - yych = *++cursor; - switch (yych) { - case ',': - goto yy37; - default: - goto yy33; - } + yych = *++cursor; + switch (yych) { + case ',': goto yy37; + default: goto yy33; + } yy33: - t1 = yyt1; - t2 = yyt2; - { - char last = *(cursor - 1); + t1 = yyt1; + t2 = yyt2; + { + char last = *(cursor - 1); - if (remainder) { - *remainder = cursor; - } - return (struct at_token){.start = t1, - .len = t2 - t1, - .type = AT_TOKEN_TYPE_QUOTED_STRING, - .var = last == ',' ? AT_TOKEN_VAR_COMMA - : AT_TOKEN_VAR_NO_COMMA}; - } + if (remainder) *remainder = cursor; + return (struct at_token){ + .start = t1, .len = t2 - t1, + .type = AT_TOKEN_TYPE_QUOTED_STRING, + .var = last == ',' ? AT_TOKEN_VAR_COMMA : AT_TOKEN_VAR_NO_COMMA + }; + } yy34: - yych = *++cursor; + yych = *++cursor; yy35: - switch (yych) { + switch (yych) { case 0x00: - case '(': - goto yy28; - case ')': - goto yy38; - default: - goto yy34; - } + case '(': goto yy28; + case ')': goto yy38; + default: goto yy34; + } yy36: - ++cursor; - goto yy25; + ++cursor; + goto yy25; yy37: - ++cursor; - goto yy33; + ++cursor; + goto yy33; yy38: - yych = *++cursor; - yyt1 = cursor; - switch (yych) { - case ',': - goto yy40; - default: - goto yy39; - } + yych = *++cursor; + yyt1 = cursor; + switch (yych) { + case ',': goto yy40; + default: goto yy39; + } yy39: - t1 = yyt2; - t2 = yyt1; - { - char last = *(cursor - 1); + t1 = yyt2; + t2 = yyt1; + { + char last = *(cursor - 1); - if (remainder) { - *remainder = cursor; - } - return (struct at_token){.start = t1, - .len = t2 - t1, - .type = AT_TOKEN_TYPE_ARRAY, - .var = last == ',' ? AT_TOKEN_VAR_COMMA - : AT_TOKEN_VAR_NO_COMMA}; - } -yy40: - ++cursor; - goto yy39; + if (remainder) *remainder = cursor; + return (struct at_token){ + .start = t1, .len = t2 - t1, + .type = AT_TOKEN_TYPE_ARRAY, + .var = last == ',' ? AT_TOKEN_VAR_COMMA : AT_TOKEN_VAR_NO_COMMA + }; } +yy40: + ++cursor; + goto yy39; +} + } struct at_token at_match_str(const char *at, const char **remainder) @@ -712,16 +651,14 @@ struct at_token at_match_str(const char *at, const char **remainder) const char *t1; const char *t2; - const char *yyt1; - const char *yyt2; +const char *yyt1;const char *yyt2; - { - unsigned char yych; - yych = *cursor; - switch (yych) { - case ' ': - goto yy44; +{ + unsigned char yych; + yych = *cursor; + switch (yych) { + case ' ': goto yy44; case '0': case '1': case '2': @@ -786,17 +723,15 @@ struct at_token at_match_str(const char *at, const char **remainder) case 'z': yyt1 = cursor; goto yy45; - default: - goto yy42; - } + default: goto yy42; + } yy42: - ++cursor; -yy43: { - return (struct at_token){.type = AT_TOKEN_TYPE_INVALID}; -} + ++cursor; +yy43: + { return (struct at_token){ .type = AT_TOKEN_TYPE_INVALID }; } yy44: - yych = *++cursor; - switch (yych) { + yych = *++cursor; + switch (yych) { case '0': case '1': case '2': @@ -861,12 +796,11 @@ yy43: { case 'z': yyt1 = cursor; goto yy45; - default: - goto yy43; - } + default: goto yy43; + } yy45: - yych = *(marker = ++cursor); - switch (yych) { + yych = *(marker = ++cursor); + switch (yych) { case '\r': yyt2 = cursor; goto yy47; @@ -935,39 +869,34 @@ yy43: { case 'w': case 'x': case 'y': - case 'z': - goto yy45; + case 'z': goto yy45; default: yyt2 = cursor; goto yy46; - } + } yy46: - t1 = yyt1; - t2 = yyt2; - { - if (remainder) { - *remainder = t2; - } - return (struct at_token){ - .start = t1, - .len = t2 - t1, - .type = AT_TOKEN_TYPE_STRING, - }; - } + t1 = yyt1; + t2 = yyt2; + { + if (remainder) *remainder = t2; + return (struct at_token){ + .start = t1, .len = t2 - t1, + .type = AT_TOKEN_TYPE_STRING, + }; + } yy47: - yych = *++cursor; - switch (yych) { - case '\n': - goto yy49; - default: - goto yy48; - } + yych = *++cursor; + switch (yych) { + case '\n': goto yy49; + default: goto yy48; + } yy48: - cursor = marker; - yyt2 = cursor; - goto yy46; + cursor = marker; + yyt2 = cursor; + goto yy46; yy49: - ++cursor; - goto yy46; - } + ++cursor; + goto yy46; +} + }