Skip to content

fix(lexers): recognize Java octal character escapes - #1477

Merged
github-actions[bot] merged 1 commit into
alecthomas:masterfrom
yxshee:codex/chroma-java-octal-char
Nov 10, 2026
Merged

github-actions[bot] merged 1 commit into
alecthomas:masterfrom
yxshee:codex/chroma-java-octal-char

Conversation

@yxshee

@yxshee yxshee commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Java will allow these octal escapes however the lexer will generate error tokens rather than keeping them as one char literal:

char value = '\141';
if (value != 'a') throw new AssertionError();
char zero = '\00';
char max = '\377';

Change the char rule to allow two octal digits or three if they start with a digit from zero through three. Keep existing rules for a single char escape or Unicode escape.

New fixture fails against base with the following error and succeeds when fix is applied:

Found Error token

All 1280 compiled Java cases and all 640 Markdown/CQL embedding cases pass. 26 control inputs and 642 corpus inputs are unaffected. bin/bit -f test bin/bit -f lint bin/bit -f check-generated and go test -count=1 ./... succeed.

@github-actions
github-actions Bot enabled auto-merge (squash) November 10, 2026 14:30
@github-actions
github-actions Bot merged commit efc294d into alecthomas:master Nov 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant