Skip to content

Commit 5b9087a

Browse files
nocd5alecthomas
authored andcommitted
Fix CSS lexer
Fix function that include parenthesis shows a wrong error
1 parent 6e272cf commit 5b9087a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Diff for: lexers/c/css.go

+13
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ var CSS = internal.Register(MustNewLexer(
3939
Include("basics"),
4040
{`\}`, Punctuation, Pop(2)},
4141
},
42+
"atparenthesis": {
43+
Include("common-values"),
44+
{`/\*(?:.|\n)*?\*/`, Comment, nil},
45+
Include("numeric-values"),
46+
{`[*+/-]`, Operator, nil},
47+
{`[,]`, Punctuation, nil},
48+
{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
49+
{`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil},
50+
{`[a-zA-Z_-]\w*`, Name, nil},
51+
{`\(`, Punctuation, Push("atparenthesis")},
52+
{`\)`, Punctuation, Pop(1)},
53+
},
4254
"content": {
4355
{`\s+`, Text, nil},
4456
{`\}`, Punctuation, Pop(1)},
@@ -73,6 +85,7 @@ var CSS = internal.Register(MustNewLexer(
7385
{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
7486
{`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil},
7587
{`[a-zA-Z_-]\w*`, Name, nil},
88+
{`\(`, Punctuation, Push("atparenthesis")},
7689
{`\)`, Punctuation, Pop(1)},
7790
},
7891
"common-values": {

0 commit comments

Comments
 (0)