Browse Source

parser: optimize, reuse ValueNode creator fn

Herbert Vojčík 7 years ago
parent
commit
3f13e75a0a
2 changed files with 203 additions and 215 deletions
  1. 199 211
      support/parser.js
  2. 4 4
      support/parser.pegjs

File diff suppressed because it is too large
+ 199 - 211
support/parser.js


+ 4 - 4
support/parser.pegjs

@@ -15,11 +15,11 @@ keyword = $(identifier ':')
 
 className = $([A-Z] [a-zA-Z0-9]*)
 
-string = contents:rawString {
+string = val:rawString {
 	return $globals.ValueNode._new()
 		._location_(location())
 		._source_(text())
-		._value_(contents);
+		._value_(val);
 }
 
 rawString = '\'' val:(('\'\'' {return '\'';} / [^'])*) '\'' {return val.join('');}
@@ -40,11 +40,11 @@ bareSymbol = val:($(keyword+) / binarySelector / unarySelector / rawString) {
 		._value_(val);
 }
 
-number = n:rawNumber {
+number = val:rawNumber {
 	return $globals.ValueNode._new()
 		._location_(location())
 		._source_(text())
-		._value_(n);
+		._value_(val);
 }
 
 rawNumber = numberExp / hex / float / integer

Some files were not shown because too many files changed in this diff