From de8326d00dffdb500c02839a98330b869c2457f3 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sat, 22 Dec 2018 09:28:48 -0800 Subject: Trim trailing white space throughout the project Many editors clean up trailing white space on save. By removing it all in one go, it helps keep future diffs cleaner by avoiding spurious white space changes on unrelated lines. --- examples/protobuf_parser.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'examples/protobuf_parser.py') diff --git a/examples/protobuf_parser.py b/examples/protobuf_parser.py index 8f8b12d..9be2c7e 100644 --- a/examples/protobuf_parser.py +++ b/examples/protobuf_parser.py @@ -14,7 +14,7 @@ integer = Regex(r"[+-]?\d+") LBRACE,RBRACE,LBRACK,RBRACK,LPAR,RPAR,EQ,SEMI = map(Suppress,"{}[]()=;") -kwds = """message required optional repeated enum extensions extends extend +kwds = """message required optional repeated enum extensions extends extend to package service rpc returns true false option import""" for kw in kwds.split(): exec("{}_ = Keyword('{}')".format(kw.upper(), kw)) @@ -23,11 +23,11 @@ messageBody = Forward() messageDefn = MESSAGE_ - ident("messageId") + LBRACE + messageBody("body") + RBRACE -typespec = oneOf("""double float int32 int64 uint32 uint64 sint32 sint64 +typespec = oneOf("""double float int32 int64 uint32 uint64 sint32 sint64 fixed32 fixed64 sfixed32 sfixed64 bool string bytes""") | ident rvalue = integer | TRUE_ | FALSE_ | ident fieldDirective = LBRACK + Group(ident + EQ + rvalue) + RBRACK -fieldDefn = (( REQUIRED_ | OPTIONAL_ | REPEATED_ )("fieldQualifier") - +fieldDefn = (( REQUIRED_ | OPTIONAL_ | REPEATED_ )("fieldQualifier") - typespec("typespec") + ident("ident") + EQ + integer("fieldint") + ZeroOrMore(fieldDirective) + SEMI) # enumDefn ::= 'enum' ident '{' { ident '=' integer ';' }* '}' @@ -43,8 +43,8 @@ messageExtension = EXTEND_ - ident + LBRACE + messageBody + RBRACE messageBody << Group(ZeroOrMore( Group(fieldDefn | enumDefn | messageDefn | extensionsDefn | messageExtension) )) # methodDefn ::= 'rpc' ident '(' [ ident ] ')' 'returns' '(' [ ident ] ')' ';' -methodDefn = (RPC_ - ident("methodName") + - LPAR + Optional(ident("methodParam")) + RPAR + +methodDefn = (RPC_ - ident("methodName") + + LPAR + Optional(ident("methodParam")) + RPAR + RETURNS_ + LPAR + Optional(ident("methodReturn")) + RPAR) # serviceDefn ::= 'service' ident '{' methodDefn* '}' @@ -66,10 +66,10 @@ parser = Optional(packageDirective) + ZeroOrMore(topLevelStatement) parser.ignore(comment) -test1 = """message Person { - required int32 id = 1; - required string name = 2; - optional string email = 3; +test1 = """message Person { + required int32 id = 1; + required string name = 2; + optional string email = 3; }""" test2 = """package tutorial; -- cgit v1.2.1