Add t_tilde token for '~'

To be used inside general_sibling_selector (e.g. 'a ~ b { ... }')
instead of the literal '~'. Necessary since we had to remove the literal
from the lexer in order to tokenize ~"..." and ~'...'.
This commit is contained in:
Sascha Peilicke
2013-12-11 18:52:08 +01:00
parent e34dde8950
commit 776ae813bd
2 changed files with 7 additions and 2 deletions

View File

@@ -53,6 +53,7 @@ class LessLexer:
't_popen',
't_pclose',
't_semicolon',
't_tilde',
't_lsopen',
't_lsclose',
@@ -234,6 +235,10 @@ class LessLexer:
t.lexer.push_state('lessstringapostrophe')
return t
def t_t_tilde(self, t):
r'~'
return t
def t_lessstringquotes_less_variable(self, t):
r'@\{[^@"\}]+\}'
return t

View File

@@ -797,8 +797,8 @@ class LessParser(object):
p[0] = tuple(list(p)[1:])
def p_general_sibling_selector(self, p):
""" general_sibling_selector : '~' t_ws
| '~'
""" general_sibling_selector : t_tilde t_ws
| t_tilde
"""
p[0] = tuple(list(p)[1:])