Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Less fails with PatternSyntaxException #609

Closed
snuyanzin opened this issue Dec 1, 2020 · 1 comment
Closed

Less fails with PatternSyntaxException #609

snuyanzin opened this issue Dec 1, 2020 · 1 comment
Milestone

Comments

@snuyanzin
Copy link
Contributor

java.util.regex.PatternSyntaxException: Unclosed character class near index 77
'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'
                                                                             ^
	at java.util.regex.Pattern.error(Pattern.java:1969)
	at java.util.regex.Pattern.clazz(Pattern.java:2562)
	at java.util.regex.Pattern.sequence(Pattern.java:2077)
	at java.util.regex.Pattern.expr(Pattern.java:2010)
	at java.util.regex.Pattern.group0(Pattern.java:2919)
	at java.util.regex.Pattern.sequence(Pattern.java:2065)
	at java.util.regex.Pattern.expr(Pattern.java:2010)
	at java.util.regex.Pattern.compile(Pattern.java:1702)
	at java.util.regex.Pattern.<init>(Pattern.java:1352)
	at java.util.regex.Pattern.compile(Pattern.java:1028)
	at org.jline.builtins.Nano$NanorcParser.doPattern(Nano.java:1797)
	at org.jline.builtins.Nano$NanorcParser.addHighlightRule(Nano.java:1784)
	at org.jline.builtins.Nano$NanorcParser.parse(Nano.java:1697)
	at org.jline.builtins.Nano$SyntaxHighlighter.build(Nano.java:1435)
	at org.jline.builtins.Less.openSource(Less.java:1023)
	at org.jline.builtins.Less.run(Less.java:324)
	at org.jline.builtins.Commands.less(Commands.java:150)
	at org.jline.builtins.Commands.less(Commands.java:122)

As WA with disabled highlighting it works ok

@mattirn
Copy link
Collaborator

mattirn commented Dec 1, 2020

Fixed nanorc file parsing. Now highlighting rule is parsed correctly but one regex is not valid for Java:

PatternSyntaxException: Unclosed character class near index 26
'([^'\]|(\\["'abfnrtv\\]))'
                          ^

I would write this regex as '([^'\\]|(\\["'abfnrtv\\]))'. I think the only reasonable solution is to edit the nanorc file.

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

No branches or pull requests

2 participants