Loading lib/flex/flex.cpp +3 −1 Changes for lib/flex/flex.cpp: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -233,7 +233,9 @@ std::string LexReader::readPatternToken() { if (bracketDepth == 0 && (c == ' ' || c == '\t' || c == '\n') && !inFreeSpacing()) break; if (bracketDepth == 0 && c == '(') { bool x = inFreeSpacing(); if (peek(1) == '?') { if (peek(1) == '?' && peek(2) == '#') { x = true; } else if (peek(1) == '?') { for (size_t k = 2; ; ++k) { char f = peek(k); if (f == 'x') x = true; Loading lib/flex/test/run.sh +6 −6 Changes for lib/flex/test/run.sh: 6 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ FLEX=${1:-flex}; CC=${2:-cc} T=$(mktemp -d); trap 'rm -rf "$T"' EXIT pass=0; fail=0 # what -lfl would bring echo 'extern int yylex(); __attribute__((weak)) int main(void){ yylex(); return 0; }' > "$T/m0.c" echo '__attribute__((weak)) int yylex(); __attribute__((weak)) int main(void){ yylex(); return 0; }' > "$T/m0.c" # check NAME LFILE INPUT EXPECTED check() { Loading @@ -13,7 +13,7 @@ check() { if ! (cd "$T" && $FLEX -o s.c "$l" 2>err.txt && $CC -std=gnu99 -Wall -Werror=implicit-function-declaration -Wno-unused -o s s.c m0.c 2>>err.txt); then echo "FAIL $name (build)"; head -8 "$T/err.txt"; fail=$((fail+1)); return fi got=$(printf "$input" | "$T/s" 2>&1) got=$(printf "$input" | timeout 5 "$T/s" 2>&1 | head -c 2000) if [ "$got" = "$want" ]; then pass=$((pass+1)); else echo "FAIL $name"; echo " want: $want"; echo " got: $got"; fail=$((fail+1)) fi Loading Loading @@ -54,7 +54,7 @@ cat > "$T/trail.l" <<'E' %option noyywrap %% foo/bar printf("[%s]", yytext); a*/a*b printf("<%s>", yytext); a+/a*b printf("<%s>", yytext); .|\n printf("%s", yytext); E check trailing trail.l 'foobar foo aab' '[foo]bar foo <aa>b' Loading Loading @@ -127,7 +127,7 @@ cat > "$T/cond.l" <<'E' <<EOF>> { printf("E%d", YY_START); yyterminate(); } <C><<EOF>> { printf("U"); yyterminate(); } E check conditions cond.l 'a/*ab*/b' 'ABBE0' check conditions cond.l 'a/*ab*/b' 'ABE0' check eof-in-condition cond.l 'a/*x' 'AU' cat > "$T/block.l" <<'E' Loading Loading @@ -168,7 +168,7 @@ cat > "$T/flags.l" <<'E' (?# nothing )w printf("6"); .|\n ; E check group-flags flags.l 'ABcdef a\nb xyz bcq 0q w' '12345 6' 2>/dev/null check group-flags flags.l 'ABcdef a\nb xyz bcq 0q w' '123456' cat > "$T/rep.l" <<'E' %option noyywrap Loading Loading @@ -241,7 +241,7 @@ check scan-api scan.l '' '[xy][zw][qr][ab][cd] 1' cat > "$T/stack.l" <<'E' %option noyywrap %% "<" { yypush_buffer_state(yy_scan_string("in")); } "<" { yypush_buffer_state(yy_create_buffer(fmemopen("in", 2, "r"), YY_BUF_SIZE)); } <<EOF>> { yypop_buffer_state(); if(!YY_CURRENT_BUFFER) yyterminate(); } [a-z]+ printf("[%s]", yytext); .|\n ; Loading Loading
lib/flex/flex.cpp +3 −1 Changes for lib/flex/flex.cpp: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -233,7 +233,9 @@ std::string LexReader::readPatternToken() { if (bracketDepth == 0 && (c == ' ' || c == '\t' || c == '\n') && !inFreeSpacing()) break; if (bracketDepth == 0 && c == '(') { bool x = inFreeSpacing(); if (peek(1) == '?') { if (peek(1) == '?' && peek(2) == '#') { x = true; } else if (peek(1) == '?') { for (size_t k = 2; ; ++k) { char f = peek(k); if (f == 'x') x = true; Loading
lib/flex/test/run.sh +6 −6 Changes for lib/flex/test/run.sh: 6 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ FLEX=${1:-flex}; CC=${2:-cc} T=$(mktemp -d); trap 'rm -rf "$T"' EXIT pass=0; fail=0 # what -lfl would bring echo 'extern int yylex(); __attribute__((weak)) int main(void){ yylex(); return 0; }' > "$T/m0.c" echo '__attribute__((weak)) int yylex(); __attribute__((weak)) int main(void){ yylex(); return 0; }' > "$T/m0.c" # check NAME LFILE INPUT EXPECTED check() { Loading @@ -13,7 +13,7 @@ check() { if ! (cd "$T" && $FLEX -o s.c "$l" 2>err.txt && $CC -std=gnu99 -Wall -Werror=implicit-function-declaration -Wno-unused -o s s.c m0.c 2>>err.txt); then echo "FAIL $name (build)"; head -8 "$T/err.txt"; fail=$((fail+1)); return fi got=$(printf "$input" | "$T/s" 2>&1) got=$(printf "$input" | timeout 5 "$T/s" 2>&1 | head -c 2000) if [ "$got" = "$want" ]; then pass=$((pass+1)); else echo "FAIL $name"; echo " want: $want"; echo " got: $got"; fail=$((fail+1)) fi Loading Loading @@ -54,7 +54,7 @@ cat > "$T/trail.l" <<'E' %option noyywrap %% foo/bar printf("[%s]", yytext); a*/a*b printf("<%s>", yytext); a+/a*b printf("<%s>", yytext); .|\n printf("%s", yytext); E check trailing trail.l 'foobar foo aab' '[foo]bar foo <aa>b' Loading Loading @@ -127,7 +127,7 @@ cat > "$T/cond.l" <<'E' <<EOF>> { printf("E%d", YY_START); yyterminate(); } <C><<EOF>> { printf("U"); yyterminate(); } E check conditions cond.l 'a/*ab*/b' 'ABBE0' check conditions cond.l 'a/*ab*/b' 'ABE0' check eof-in-condition cond.l 'a/*x' 'AU' cat > "$T/block.l" <<'E' Loading Loading @@ -168,7 +168,7 @@ cat > "$T/flags.l" <<'E' (?# nothing )w printf("6"); .|\n ; E check group-flags flags.l 'ABcdef a\nb xyz bcq 0q w' '12345 6' 2>/dev/null check group-flags flags.l 'ABcdef a\nb xyz bcq 0q w' '123456' cat > "$T/rep.l" <<'E' %option noyywrap Loading Loading @@ -241,7 +241,7 @@ check scan-api scan.l '' '[xy][zw][qr][ab][cd] 1' cat > "$T/stack.l" <<'E' %option noyywrap %% "<" { yypush_buffer_state(yy_scan_string("in")); } "<" { yypush_buffer_state(yy_create_buffer(fmemopen("in", 2, "r"), YY_BUF_SIZE)); } <<EOF>> { yypop_buffer_state(); if(!YY_CURRENT_BUFFER) yyterminate(); } [a-z]+ printf("[%s]", yytext); .|\n ; Loading