Permalink
Browse files

now use wrap() when attaching to primitives

  • Loading branch information...
1 parent 13af41a commit ecdbefa72b5e0b677b230a1048bdc1b9c597094a @alxlit committed Jan 22, 2012
Showing with 228 additions and 266 deletions.
  1. +10 −32 coffeescript/classes/lexer.php
  2. +203 −205 coffeescript/classes/parser.php
  3. +6 −18 coffeescript/classes/rewriter.php
  4. +6 −1 grammar.y
  5. +3 −10 vendor/ParserGenerator/PHP/Lempar.php
@@ -394,17 +394,12 @@ function identifier_token()
}
}
- $reserved = FALSE;
-
if (in_array($id, self::$JS_FORBIDDEN, TRUE))
{
if ($forced_identifier)
{
- // TODO: Doing this seems to work just fine. Sometime in the future I
- // will take out the nastiness of attaching properties to the token
- // rather than directly to the value like below.
$id = wrap($id);
- $id->reserved = $reserved = TRUE;
+ $id->reserved = TRUE;
$tag = 'IDENTIFIER';
}
@@ -439,7 +434,7 @@ function identifier_token()
}
}
- $this->token($tag, $id, array('reserved' => $reserved));
+ $this->token($tag, $id);
if ($colon)
{
@@ -839,12 +834,7 @@ function regex_token()
if (preg_match(self::$HEREGEX, $this->chunk, $match))
{
- $length = $this->heregex_token($match);
-
- // This seems to be broken in the JavaScript compiler...
- // $this->line += substr_count($match[0], "\n");
-
- return $length;
+ return $this->heregex_token($match);
}
$prev = last($this->tokens);
@@ -882,7 +872,7 @@ function sanitize_heredoc($doc, array $options)
throw new Error('block comment cannot contain \"*/\", starting on line '.($line + 1));
}
- if (strpos($doc, "\n") == 0) // No match or 0
+ if ( ! strpos($doc, "\n"))
{
return $doc;
}
@@ -945,7 +935,7 @@ function string_token()
}
break;
-
+
default:
return 0;
}
@@ -1011,7 +1001,7 @@ function tag_parameters()
return $this;
}
- function token($tag, $value = NULL, $props = array())
+ function token($tag, $value = NULL)
{
if ( ! is_numeric($tag))
{
@@ -1020,14 +1010,6 @@ function token($tag, $value = NULL, $props = array())
$token = array($tag, $value, $this->line);
- if ($props)
- {
- foreach ($props as $k => $v)
- {
- $token[$k] = $v;
- }
- }
-
return ($this->tokens[] = $token);
}
@@ -1075,14 +1057,10 @@ function unfinished()
{
return
preg_match(self::$LINE_CONTINUER, $this->chunk) ||
- ($prev = last($this->tokens, 1)) &&
- ($prev[0] !== t('.')) &&
- ($value = $this->value()) &&
- // ( ! (isset($value->reserved) && $value->reserved)) &&
- ( ! (isset($prev['reserved']) && $prev['reserved'])) &&
- preg_match(self::$NO_NEWLINE, $value) &&
- ( ! preg_match(self::$CODE, $value)) &&
- ( ! preg_match(self::$ASSIGNED, $this->chunk));
+ ($prev = last($this->tokens, 1)) && ($prev[0] !== t('.')) &&
+ ($value = $this->value()) && ! (isset($value->reserved) && $value->reserved) &&
+ preg_match(self::$NO_NEWLINE, $value) && ( ! preg_match(self::$CODE, $value))
+ && ( ! preg_match(self::$ASSIGNED, $this->chunk));
}
function whitespace_token()
Oops, something went wrong.

0 comments on commit ecdbefa

Please sign in to comment.