From 5b9087ac14469c923458092b284c9f474d7ca2a1 Mon Sep 17 00:00:00 2001 From: nocd5 Date: Wed, 23 Dec 2020 22:30:41 +0900 Subject: [PATCH] Fix CSS lexer Fix function that include parenthesis shows a wrong error --- lexers/c/css.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lexers/c/css.go b/lexers/c/css.go index fedc809bf..78251b7ae 100644 --- a/lexers/c/css.go +++ b/lexers/c/css.go @@ -39,6 +39,18 @@ var CSS = internal.Register(MustNewLexer( Include("basics"), {`\}`, Punctuation, Pop(2)}, }, + "atparenthesis": { + Include("common-values"), + {`/\*(?:.|\n)*?\*/`, Comment, nil}, + Include("numeric-values"), + {`[*+/-]`, Operator, nil}, + {`[,]`, Punctuation, nil}, + {`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, + {`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, + {`[a-zA-Z_-]\w*`, Name, nil}, + {`\(`, Punctuation, Push("atparenthesis")}, + {`\)`, Punctuation, Pop(1)}, + }, "content": { {`\s+`, Text, nil}, {`\}`, Punctuation, Pop(1)}, @@ -73,6 +85,7 @@ var CSS = internal.Register(MustNewLexer( {`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil}, {`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil}, {`[a-zA-Z_-]\w*`, Name, nil}, + {`\(`, Punctuation, Push("atparenthesis")}, {`\)`, Punctuation, Pop(1)}, }, "common-values": {