Skip to content

Commit

Permalink
changed according to review
Browse files Browse the repository at this point in the history
git-svn-id: https://antlrphpruntime.googlecode.com/svn/branches/rollxx@30 469e59e2-98e4-11dd-87e9-a30ea5446288
  • Loading branch information
rollxx committed Feb 25, 2010
1 parent 453031f commit 9c19835
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions runtime/Php/UnwantedTokenException.php
Expand Up @@ -39,14 +39,14 @@ public function getUnexpectedToken() {
}

public function __toString() {
$exp = ", expected "+$this->expecting;
$exp = ", expected ".$this->expecting;
if ( $this->expecting==TokenConst::$INVALID_TOKEN_TYPE ) {
$exp = "";
}
if ( $this->token==null ) {
return "UnwantedTokenException(found="+$exp+")";
return "UnwantedTokenException(found=".$exp.")";
}
return "UnwantedTokenException(found="+$this->token->getText()+$exp+")";
return "UnwantedTokenException(found=".$this->token->getText().$exp.")";
}
}

Expand Down
11 changes: 6 additions & 5 deletions runtime/Php/tree/TreeRuleReturnScope.php
@@ -1,4 +1,3 @@
<?php
/*
[The "BSD licence"]
Copyright (c) 2005-2008 Terence Parr
Expand Down Expand Up @@ -26,15 +25,17 @@
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
require_once('RuleReturnScope.php');
package org.antlr.runtime.tree;

import org.antlr.runtime.RuleReturnScope;

/** This is identical to the ParserRuleReturnScope except that
* the start property is a tree nodes not Token object
* when you are parsing trees. To be generic the tree node types
* have to be Object.
*/
class TreeRuleReturnScope extends RuleReturnScope {
public class TreeRuleReturnScope extends RuleReturnScope {
/** First node or root node of tree matched for this rule. */
public $start;
public function getStart() { return $this->start; }
public Object start;
public Object getStart() { return start; }
}
Expand Up @@ -392,7 +392,7 @@ catch (<e.decl>) {

ruleDeclarations() ::= <<
<if(ruleDescriptor.hasMultipleReturnValues)>
$retval = $this-><returnType()>();
$retval = new <returnType()>();
$retval->start = $this->input->LT(1);<\n>
<else>
<ruleDescriptor.returnScope.attributes:{ a |
Expand Down Expand Up @@ -734,7 +734,7 @@ lexerStringRef(string,label) ::= <<
<if(label)>
int <label>Start = getCharIndex();
match(<string>); <checkRuleBacktrackFailure()>
<label> = new CommonToken(input, TokenConst::$INVALID_TOKEN_TYPE, TokenConst::$DEFAULT_CHANNEL, <label>Start, getCharIndex()-1);
<labelType> <label> = new CommonToken(input, EOF, Token.DEFAULT_CHANNEL, <label>Start<elementIndex>, getCharIndex()-1);
<else>
$this->matchString(<string>); <checkRuleBacktrackFailure()><\n>
<endif>
Expand Down Expand Up @@ -811,7 +811,7 @@ lexerMatchEOF(label,elementIndex) ::= <<
<if(label)>
int <label>Start<elementIndex> = getCharIndex();
match(EOF); <checkRuleBacktrackFailure()>
<labelType> <label> = new CommonToken(input, EOF, TokenConst::$DEFAULT_CHANNEL, <label>Start<elementIndex>, getCharIndex()-1);
<labelType> <label> = new CommonToken(input, EOF, Token.DEFAULT_CHANNEL, <label>Start<elementIndex>, getCharIndex()-1);
<else>
match(EOF); <checkRuleBacktrackFailure()>
<endif>
Expand Down

0 comments on commit 9c19835

Please sign in to comment.