mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Add support for CSS styles
This commit is contained in:
parent
75a05fe5ce
commit
bef92f2879
4 changed files with 73 additions and 2 deletions
|
@ -319,6 +319,19 @@ class ZeroOrMore(ParseNode):
|
|||
return True
|
||||
|
||||
|
||||
class Delimited(ParseNode):
|
||||
""" ParseNode that matches its first child any number of times (including zero
|
||||
times) with its second child in between and optionally at the end. """
|
||||
def __init__(self, child, delimiter):
|
||||
self.child = child
|
||||
self.delimiter = delimiter
|
||||
|
||||
def _parse(self, ctx):
|
||||
while self.child.parse(ctx).matched() and self.delimiter.parse(ctx).matched():
|
||||
pass
|
||||
return True
|
||||
|
||||
|
||||
class Optional(ParseNode):
|
||||
""" ParseNode that matches its child zero or one times. It cannot fail to
|
||||
parse. """
|
||||
|
@ -362,6 +375,9 @@ class OpenParen(StaticToken):
|
|||
class CloseParen(StaticToken):
|
||||
token_type = TokenType.CLOSE_PAREN
|
||||
|
||||
class Comma(StaticToken):
|
||||
token_type = TokenType.COMMA
|
||||
|
||||
|
||||
class Op(ParseNode):
|
||||
""" ParseNode that matches the given operator. """
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue