Skip to content

Commit

Permalink
Nanorc parser: replace Posix char class regexes with Java regexes
Browse files Browse the repository at this point in the history
  • Loading branch information
mattirn committed Dec 5, 2020
1 parent 172644f commit 82ca0f0
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions builtins/src/main/java/org/jline/builtins/Nano.java
Original file line number Diff line number Diff line change
Expand Up @@ -1687,10 +1687,23 @@ public NanorcParser(InputStream in, String name, String target) {

public void parse() throws IOException {
String line = reader.readLine();
while (line!= null) {
while (line != null) {
line = line.trim();
if (line.length() > 0 && !line.startsWith("#")) {
line = line.replaceAll("\\\\<", "\\\\b").replaceAll("\\\\>", "\\\\b").replaceAll("\\[\\[:space:]]", "\\\\s");
line = line.replaceAll("\\\\<", "\\\\b")
.replaceAll("\\\\>", "\\\\b")
.replaceAll("\\[:alnum:]", "\\\\p{Alnum}")
.replaceAll("\\[:alpha:]", "\\\\p{Alpha}")
.replaceAll("\\[:blank:]", "\\\\p{Blank}")
.replaceAll("\\[:cntrl:]", "\\\\p{Cntrl}")
.replaceAll("\\[:digit:]", "\\\\p{Digit}")
.replaceAll("\\[:graph:]", "\\\\p{Graph}")
.replaceAll("\\[:lower:]", "\\\\p{Lower}")
.replaceAll("\\[:print:]", "\\\\p{Print}")
.replaceAll("\\[:punct:]", "\\\\p{Punct}")
.replaceAll("\\[:space:]", "\\\\s")
.replaceAll("\\[:upper:]", "\\\\p{Upper}")
.replaceAll("\\[:xdigit:]", "\\\\p{XDigit}");
List<String> parts = Parser.split(line);
if (parts.get(0).equals("syntax")) {
syntaxName = parts.get(1);
Expand Down

0 comments on commit 82ca0f0

Please sign in to comment.