From 732873a2a3dd920e2725f52c3e80dddb1ec48e22 Mon Sep 17 00:00:00 2001 From: "Brian T. Rice" Date: Sun, 30 Jan 2011 19:08:04 -0800 Subject: [PATCH] ::= reversions in the Parser. --- src/syntax/parser.slate | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/syntax/parser.slate b/src/syntax/parser.slate index 469f567..4999afd 100644 --- a/src/syntax/parser.slate +++ b/src/syntax/parser.slate @@ -55,7 +55,7 @@ p@(Parser traits) excludedTokens &interactive: interactive p@(Parser traits) nextToken &interactive: interactive "Takes the next token from either the buffer or the lexer transparently." -[| exclude token | +[| token exclude | exclude := p excludedTokens &interactive: interactive. [p is: (token := p lexer next) likeAnyOf: exclude] whileTrue. @@ -65,7 +65,7 @@ p@(Parser traits) nextToken &interactive: interactive p@(Parser traits) peekToken &interactive: interactive "Return the next non-stop token from the Lexer, but leave it in the buffer and don't update the position." -[| exclude token lookAheadIndex | +[| token lookAheadIndex exclude | exclude := p excludedTokens &interactive: interactive. "Return the next non-stop token." lookAheadIndex := -1. @@ -113,8 +113,8 @@ p@(Parser traits) check: found is: expected@(Sequence traits) [p expected: expected butFound: found]]. p@(Parser traits) expected: expected@(Sequence traits) butFound: found -[ - expectNames ::= expected collect: #signifier `er select: #isNotNil `er. +[| expectNames | + expectNames := expected collect: #signifier `er select: #isNotNil `er. p error: 'Expected ' ; expectNames printString ; ' but found ' ; found signifier ]. @@ -143,7 +143,7 @@ p@(Parser traits) nextAsStatement p@(Parser traits) next "The top-level Stream processing to return the next syntax node." -[| statement token terminatesCorrectly | +[| token terminatesCorrectly statement | statement := p nextExpression. "Unless parsing lines greedily, statements need to be separated explicitly or be at the end of the input." (terminatesCorrectly := p is: (token := p nextToken) likeAnyOf: p EndStatementTokens) -- 2.11.4.GIT