Skip to content

Prevent white spaces in certain rules #2016

Answered by bd82
rzcoder asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @rzcoder

Note that the syntax you want to prevent is allowed TypeScript and Java, so it is not that "strange".

Whitespace decides between alternative example

Even though whitespace is ignored in the rest of the grammar.

$.OR([
{
GATE: () => {
const prevToken = $.LA(0);
const nextToken = $.LA(1);
// This is the only place in CSS where the grammar is whitespace sensitive.
return nextToken.startOffset > prevToken.endOffset;
},
ALT: () => {
$.OPTION2

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by rzcoder
Comment options

You must be logged in to vote
2 replies
@bd82
Comment options

@matthew-dean
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants