Skip to content

Commit

Permalink
Only catch \iffalse at the beginning of a line
Browse files Browse the repository at this point in the history
There may be optional spaces.
Close James-Yu/LaTeX-Workshop#4231
  • Loading branch information
jlelong committed Apr 20, 2024
1 parent f17f354 commit 8624d0b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions syntaxes/TeX.tmLanguage.json
Expand Up @@ -2,22 +2,22 @@
"name": "TeX",
"patterns": [
{
"begin": "(\\\\)iffalse",
"begin": "(?<=^\\s*)((\\\\)iffalse)",
"beginCaptures": {
"0": {
"1": {
"name": "keyword.control.tex"
},
"1": {
"2": {
"name": "punctuation.definition.keyword.tex"
}
},
"contentName": "comment.line.percentage.tex",
"end": "(\\\\)(else|fi)",
"end": "(?<=^\\s*)((\\\\)(?:else|fi))",
"endCaptures": {
"0": {
"1": {
"name": "keyword.control.tex"
},
"1": {
"2": {
"name": "punctuation.definition.keyword.tex"
}
},
Expand Down Expand Up @@ -167,8 +167,8 @@
]
},
"conditionals": {
"begin": "\\\\(if[a-z]*)",
"end": "\\\\fi",
"begin": "(?<=^\\s*)\\\\if[a-z]*",
"end": "(?<=^\\s*)\\\\fi",
"patterns": [
{
"include": "#comment"
Expand Down
16 changes: 8 additions & 8 deletions syntaxes/src/TeX.tmLanguage.yaml
@@ -1,17 +1,17 @@
name: TeX
patterns:
- begin: (\\)iffalse
- begin: (?<=^\s*)((\\)iffalse)
beginCaptures:
'0':
name: keyword.control.tex
'1':
name: keyword.control.tex
'2':
name: punctuation.definition.keyword.tex
contentName: comment.line.percentage.tex
end: (\\)(else|fi)
end: (?<=^\s*)((\\)(?:else|fi))
endCaptures:
'0':
name: keyword.control.tex
'1':
name: keyword.control.tex
'2':
name: punctuation.definition.keyword.tex
patterns:
- include: '#comment'
Expand Down Expand Up @@ -94,8 +94,8 @@ repository:
end: $\n?
name: comment.line.percentage.directive.tex
conditionals:
begin: \\(if[a-z]*)
end: \\fi
begin: (?<=^\s*)\\if[a-z]*
end: (?<=^\s*)\\fi
patterns:
- include: '#comment'
- include: '#conditionals'
Expand Down

0 comments on commit 8624d0b

Please sign in to comment.