diff --git a/Rakefile b/Rakefile index 5225d137..7f1ba3da 100644 --- a/Rakefile +++ b/Rakefile @@ -17,9 +17,14 @@ namespace :build do sh "racc #{args[:racc_args]} -o lib/coffee_script/parser.rb lib/coffee_script/grammar.y" end - desc "Compile the Narwhal interface for --interactive and --run" + desc "Compile the Narwhal interface" task :narwhal do - sh "bin/coffee lib/coffee_script/narwhal/*.coffee -o lib/coffee_script/narwhal" + sh "bin/coffee src/narwhal/*.coffee -o lib/coffee_script/narwhal" + end + + desc "Continually compile the CoffeeScript/Node.js components with --watch" + task :node do + sh "bin/coffee -w src/*.coffee -o lib/coffee_script/" end desc "Compile and install the Ultraviolet syntax highlighter" diff --git a/documentation/index.html.erb b/documentation/index.html.erb index aefebf9a..4adcd47e 100644 --- a/documentation/index.html.erb +++ b/documentation/index.html.erb @@ -118,7 +118,7 @@ gem install coffee-script Installing the gem provides the coffee command, which can be used to compile CoffeeScript .coffee files into JavaScript, as well as debug them. In conjunction with - Narwhal, the coffee + Node.js, the coffee command also provides direct evaluation and an interactive REPL. When compiling to JavaScript, coffee writes the output as .js files in the same directory by default, but output @@ -130,14 +130,14 @@ gem install coffee-script -i, --interactive Launch an interactive CoffeeScript session. - Requires Narwhal. + Requires Node.js. -r, --run Compile and execute scripts without saving the intermediate - JavaScript. Requires Narwhal. + JavaScript. Requires Node.js. @@ -194,7 +194,7 @@ gem install coffee-script -n, --no-wrap Compile the JavaScript without the top-level function safety wrapper. - (Used for CoffeeScript as a Narwhal module.) + (Used for CoffeeScript as a Node.js module.) diff --git a/examples/beautiful_code/binary_search.coffee b/examples/beautiful_code/binary_search.coffee index 9c6e02d1..8a1456a0 100644 --- a/examples/beautiful_code/binary_search.coffee +++ b/examples/beautiful_code/binary_search.coffee @@ -11,6 +11,6 @@ index: (list, target) -> if val < target then low: mid + 1 else high: mid return -1 -print(2 is index([10, 20, 30, 40, 50], 30)) -print(4 is index([-97, 35, 67, 88, 1200], 1200)) -print(0 is index([0, 45, 70], 0)) \ No newline at end of file +puts 2 is index([10, 20, 30, 40, 50], 30) +puts 4 is index([-97, 35, 67, 88, 1200], 1200) +puts 0 is index([0, 45, 70], 0) \ No newline at end of file diff --git a/examples/beautiful_code/quicksort_runtime.coffee b/examples/beautiful_code/quicksort_runtime.coffee index affd775a..6e9677f2 100644 --- a/examples/beautiful_code/quicksort_runtime.coffee +++ b/examples/beautiful_code/quicksort_runtime.coffee @@ -8,6 +8,6 @@ runtime: (N) -> t: n - 1 + sum / n t -print(runtime(3) is 2.6666666666666665) -print(runtime(5) is 7.4) -print(runtime(8) is 16.92142857142857) +puts runtime(3) is 2.6666666666666665 +puts runtime(5) is 7.4 +puts runtime(8) is 16.92142857142857 diff --git a/examples/beautiful_code/regular_expression_matcher.coffee b/examples/beautiful_code/regular_expression_matcher.coffee index 4ef8237e..903c15d2 100644 --- a/examples/beautiful_code/regular_expression_matcher.coffee +++ b/examples/beautiful_code/regular_expression_matcher.coffee @@ -26,9 +26,9 @@ match_star: (c, regexp, text) -> return false unless text and (text[0] is c or c is '.') text: text.slice(1) -print(match("ex", "some text")) -print(match("s..t", "spit")) -print(match("^..t", "buttercup")) -print(match("i..$", "cherries")) -print(match("o*m", "vrooooommm!")) -print(match("^hel*o$", "hellllllo")) \ No newline at end of file +puts match("ex", "some text") +puts match("s..t", "spit") +puts match("^..t", "buttercup") +puts match("i..$", "cherries") +puts match("o*m", "vrooooommm!") +puts match("^hel*o$", "hellllllo") \ No newline at end of file diff --git a/examples/computer_science/binary_search.coffee b/examples/computer_science/binary_search.coffee index 443eaaa0..2c5e020e 100644 --- a/examples/computer_science/binary_search.coffee +++ b/examples/computer_science/binary_search.coffee @@ -19,7 +19,7 @@ binary_search: (items, value) -> # Test the function. -print(2 is binary_search([10, 20, 30, 40, 50], 30)) -print(4 is binary_search([-97, 35, 67, 88, 1200], 1200)) -print(0 is binary_search([0, 45, 70], 0)) -print(-1 is binary_search([0, 45, 70], 10)) \ No newline at end of file +puts(2 is binary_search([10, 20, 30, 40, 50], 30)) +puts(4 is binary_search([-97, 35, 67, 88, 1200], 1200)) +puts(0 is binary_search([0, 45, 70], 0)) +puts(-1 is binary_search([0, 45, 70], 10)) \ No newline at end of file diff --git a/examples/computer_science/bubble_sort.coffee b/examples/computer_science/bubble_sort.coffee index f671bedd..f27a04df 100644 --- a/examples/computer_science/bubble_sort.coffee +++ b/examples/computer_science/bubble_sort.coffee @@ -7,5 +7,5 @@ bubble_sort: (list) -> # Test the function. -print(bubble_sort([3, 2, 1]).join(' ') is '1 2 3') -print(bubble_sort([9, 2, 7, 0, 1]).join(' ') is '0 1 2 7 9') \ No newline at end of file +puts(bubble_sort([3, 2, 1]).join(' ') is '1 2 3') +puts(bubble_sort([9, 2, 7, 0, 1]).join(' ') is '0 1 2 7 9') \ No newline at end of file diff --git a/examples/computer_science/linked_list.coffee b/examples/computer_science/linked_list.coffee index 6af3fddf..1d38e175 100644 --- a/examples/computer_science/linked_list.coffee +++ b/examples/computer_science/linked_list.coffee @@ -91,16 +91,16 @@ LinkedList::toString: -> this.toArray().toString() list: new LinkedList() list.add("Hi") -print(list.size() is 1) -print(list.item(0) is "Hi") -print(list.item(1) is null) +puts(list.size() is 1) +puts(list.item(0) is "Hi") +puts(list.item(1) is null) list: new LinkedList() list.add("zero").add("one").add("two") -print(list.size() is 3) -print(list.item(2) is "two") -print(list.remove(1) is "one") -print(list.item(0) is "zero") -print(list.item(1) is "two") -print(list.size() is 2) -print(list.item(-10) is null) +puts(list.size() is 3) +puts(list.item(2) is "two") +puts(list.remove(1) is "one") +puts(list.item(0) is "zero") +puts(list.item(1) is "two") +puts(list.size() is 2) +puts(list.item(-10) is null) diff --git a/examples/computer_science/luhn_algorithm.coffee b/examples/computer_science/luhn_algorithm.coffee index 042b249d..ceb4f3dd 100644 --- a/examples/computer_science/luhn_algorithm.coffee +++ b/examples/computer_science/luhn_algorithm.coffee @@ -31,6 +31,6 @@ is_valid_identifier: (identifier) -> # Tests. -print(is_valid_identifier("49927398716") is true) -print(is_valid_identifier("4408041234567893") is true) -print(is_valid_identifier("4408041234567890") is false) +puts(is_valid_identifier("49927398716") is true) +puts(is_valid_identifier("4408041234567893") is true) +puts(is_valid_identifier("4408041234567890") is false) diff --git a/examples/computer_science/merge_sort.coffee b/examples/computer_science/merge_sort.coffee index fb3f8ce8..77eabf97 100644 --- a/examples/computer_science/merge_sort.coffee +++ b/examples/computer_science/merge_sort.coffee @@ -15,5 +15,5 @@ merge_sort: (list) -> # Test the function. -print(merge_sort([3, 2, 1]).join(' ') is '1 2 3') -print(merge_sort([9, 2, 7, 0, 1]).join(' ') is '0 1 2 7 9') \ No newline at end of file +puts(merge_sort([3, 2, 1]).join(' ') is '1 2 3') +puts(merge_sort([9, 2, 7, 0, 1]).join(' ') is '0 1 2 7 9') \ No newline at end of file diff --git a/examples/computer_science/selection_sort.coffee b/examples/computer_science/selection_sort.coffee index f4b970a1..5c54ba38 100644 --- a/examples/computer_science/selection_sort.coffee +++ b/examples/computer_science/selection_sort.coffee @@ -9,7 +9,7 @@ selection_sort: (list) -> min: i # Check the rest of the array to see if anything is smaller. - (min: j if list[j] < list[min]) for j in [i+1...len] + (min: j if list[j] < list[min]) for j in [(i+1)...len] # Swap if a smaller item has been found. [list[i], list[min]]: [list[min], list[i]] if i isnt min @@ -19,5 +19,5 @@ selection_sort: (list) -> # Test the function. -print(selection_sort([3, 2, 1]).join(' ') is '1 2 3') -print(selection_sort([9, 2, 7, 0, 1]).join(' ') is '0 1 2 7 9') \ No newline at end of file +puts(selection_sort([3, 2, 1]).join(' ') is '1 2 3') +puts(selection_sort([9, 2, 7, 0, 1]).join(' ') is '0 1 2 7 9') \ No newline at end of file diff --git a/index.html b/index.html index c780982d..1e936013 100644 --- a/index.html +++ b/index.html @@ -215,7 +215,7 @@ gem install coffee-script Installing the gem provides the coffee command, which can be used to compile CoffeeScript .coffee files into JavaScript, as well as debug them. In conjunction with - Narwhal, the coffee + Node.js, the coffee command also provides direct evaluation and an interactive REPL. When compiling to JavaScript, coffee writes the output as .js files in the same directory by default, but output @@ -227,14 +227,14 @@ gem install coffee-script -i, --interactive Launch an interactive CoffeeScript session. - Requires Narwhal. + Requires Node.js. -r, --run Compile and execute scripts without saving the intermediate - JavaScript. Requires Narwhal. + JavaScript. Requires Node.js. @@ -291,7 +291,7 @@ gem install coffee-script -n, --no-wrap Compile the JavaScript without the top-level function safety wrapper. - (Used for CoffeeScript as a Narwhal module.) + (Used for CoffeeScript as a Node.js module.) diff --git a/lib/coffee_script/coffee-script.js b/lib/coffee_script/coffee-script.js new file mode 100644 index 00000000..c4926c52 --- /dev/null +++ b/lib/coffee_script/coffee-script.js @@ -0,0 +1,50 @@ +(function(){ + var compiler, path; + // Executes the `coffee` Ruby program to convert from CoffeeScript to JavaScript. + path = require('path'); + // The path to the CoffeeScript executable. + compiler = path.normalize(path.dirname(__filename) + '/../../bin/coffee'); + // Compile a string over stdin, with global variables, for the REPL. + exports.compile = function compile(code, callback) { + var coffee, js; + js = ''; + coffee = process.createChildProcess(compiler, ['--eval', '--no-wrap', '--globals']); + coffee.addListener('output', function(results) { + if ((typeof results !== "undefined" && results !== null)) { + return js += results; + } + }); + coffee.addListener('exit', function() { + return callback(js); + }); + coffee.write(code); + return coffee.close(); + }; + // Compile a list of CoffeeScript files on disk. + exports.compile_files = function compile_files(paths, callback) { + var coffee, exit_ran, js; + js = ''; + coffee = process.createChildProcess(compiler, ['--print'].concat(paths)); + coffee.addListener('output', function(results) { + if ((typeof results !== "undefined" && results !== null)) { + return js += results; + } + }); + // NB: we have to add a mutex to make sure it doesn't get called twice. + exit_ran = false; + coffee.addListener('exit', function() { + if (exit_ran) { + return null; + } + exit_ran = true; + return callback(js); + }); + return coffee.addListener('error', function(message) { + if (!(message)) { + return null; + } + puts(message); + throw new Error("CoffeeScript compile error"); + }); + }; +})(); \ No newline at end of file diff --git a/lib/coffee_script/command_line.rb b/lib/coffee_script/command_line.rb index 2427169a..bd855f5d 100644 --- a/lib/coffee_script/command_line.rb +++ b/lib/coffee_script/command_line.rb @@ -28,8 +28,11 @@ Usage: # Path to the root of the CoffeeScript install. ROOT = File.expand_path(File.dirname(__FILE__) + '/../..') - # Command to execute in Narwhal - LAUNCHER = "narwhal -p #{ROOT} -e 'require(\"coffee-script\").run(system.args);'" + # Commands to execute CoffeeScripts. + RUNNERS = { + :node => "node #{ROOT}/lib/coffee_script/runner.js", + :narwhal => "narwhal -p #{ROOT} -e 'require(\"coffee-script\").run(system.args);'" + } # Run the CommandLine off the contents of ARGV. def initialize @@ -114,20 +117,20 @@ Usage: puts js end - # Use Narwhal to run an interactive CoffeeScript session. + # Use Node.js or Narwhal to run an interactive CoffeeScript session. def launch_repl - exec "#{LAUNCHER}" + exec "#{RUNNERS[@options[:runner]]}" rescue Errno::ENOENT - puts "Error: Narwhal must be installed to use the interactive REPL." + puts "Error: #{@options[:runner]} must be installed to use the interactive REPL." exit(1) end - # Use Narwhal to compile and execute CoffeeScripts. + # Use Node.js or Narwhal to compile and execute CoffeeScripts. def run_scripts sources = @sources.join(' ') - exec "#{LAUNCHER} #{sources}" + exec "#{RUNNERS[@options[:runner]]} #{sources}" rescue Errno::ENOENT - puts "Error: Narwhal must be installed in order to execute CoffeeScripts." + puts "Error: #{@options[:runner]} must be installed in order to execute scripts." exit(1) end @@ -166,12 +169,12 @@ Usage: # Use OptionParser for all the options. def parse_options - @options = {} + @options = {:runner => :node} @option_parser = OptionParser.new do |opts| - opts.on('-i', '--interactive', 'run a CoffeeScript REPL (requires Narwhal)') do |i| + opts.on('-i', '--interactive', 'run an interactive CoffeeScript REPL') do |i| @options[:interactive] = true end - opts.on('-r', '--run', 'compile and run a script (requires Narwhal)') do |r| + opts.on('-r', '--run', 'compile and run a CoffeeScript') do |r| @options[:run] = true end opts.on('-o', '--output [DIR]', 'set the directory for compiled JavaScript') do |d| @@ -202,6 +205,9 @@ Usage: opts.on('-g', '--globals', 'attach all top-level variable as globals') do |n| @options[:globals] = true end + opts.on_tail('--narwhal', 'use Narwhal instead of Node.js') do |n| + @options[:runner] = :narwhal + end opts.on_tail('--install-bundle', 'install the CoffeeScript TextMate bundle') do |i| install_bundle exit diff --git a/lib/coffee_script/grammar.y b/lib/coffee_script/grammar.y index df1c2a60..5f841374 100644 --- a/lib/coffee_script/grammar.y +++ b/lib/coffee_script/grammar.y @@ -13,6 +13,7 @@ token FOR IN OF BY WHEN WHILE token SWITCH LEADING_WHEN token DELETE INSTANCEOF TYPEOF token SUPER EXTENDS +token ASSIGN RETURN token NEWLINE token COMMENT token JS @@ -20,24 +21,20 @@ token INDENT OUTDENT # Declare order of operations. prechigh - left '?' nonassoc UMINUS UPLUS NOT '!' '!!' '~' '++' '--' - left '*' '/' '%' + left '*' '/' '%' '?' '.' left '+' '-' - left '<<' '>>' '>>>' - left '&' '|' '^' + left '<<' '>>' '>>>' '&' '|' '^' left '<=' '<' '>' '>=' right '==' '!=' IS ISNT left '&&' '||' AND OR - right '-=' '+=' '/=' '*=' '%=' + right '-=' '+=' '/=' '*=' '%=' '||=' '&&=' '?=' right DELETE INSTANCEOF TYPEOF - left '.' right INDENT left OUTDENT right WHEN LEADING_WHEN IN OF BY right THROW FOR NEW SUPER left EXTENDS - left '||=' '&&=' '?=' right ASSIGN RETURN right '->' '=>' UNLESS IF ELSE WHILE preclow diff --git a/lib/coffee_script/lexer.js b/lib/coffee_script/lexer.js new file mode 100644 index 00000000..0b0ea180 --- /dev/null +++ b/lib/coffee_script/lexer.js @@ -0,0 +1,362 @@ +(function(){ + var ASSIGNMENT, CALLABLE, CODE, COMMENT, COMMENT_CLEANER, HEREDOC, HEREDOC_INDENT, IDENTIFIER, JS, JS_CLEANER, KEYWORDS, LAST_DENT, LAST_DENTS, MULTILINER, MULTI_DENT, NOT_REGEX, NO_NEWLINE, NUMBER, OPERATOR, REGEX, Rewriter, STRING, STRING_NEWLINES, WHITESPACE, lex, sys; + sys = require('sys'); + Rewriter = require('./rewriter').Rewriter; + // The lexer reads a stream of CoffeeScript and divvys it up into tagged + // tokens. A minor bit of the ambiguity in the grammar has been avoided by + // pushing some extra smarts into the Lexer. + exports.Lexer = (lex = function lex() { }); + // Constants ============================================================ + // The list of keywords passed verbatim to the parser. + KEYWORDS = ["if", "else", "then", "unless", "true", "false", "yes", "no", "on", "off", "and", "or", "is", "isnt", "not", "new", "return", "arguments", "try", "catch", "finally", "throw", "break", "continue", "for", "in", "of", "by", "where", "while", "delete", "instanceof", "typeof", "switch", "when", "super", "extends"]; + // Token matching regexes. + IDENTIFIER = /^([a-zA-Z$_](\w|\$)*)/; + NUMBER = /^(\b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?(e[+\-]?[0-9]+)?)))\b/i; + STRING = /^(""|''|"([\s\S]*?)([^\\]|\\\\)"|'([\s\S]*?)([^\\]|\\\\)')/; + HEREDOC = /^("{6}|'{6}|"{3}\n?([\s\S]*?)\n?([ \t]*)"{3}|'{3}\n?([\s\S]*?)\n?([ \t]*)'{3})/; + JS = /^(``|`([\s\S]*?)([^\\]|\\\\)`)/; + OPERATOR = /^([+\*&|\/\-%=<>:!?]+)/; + WHITESPACE = /^([ \t]+)/; + COMMENT = /^(((\n?[ \t]*)?#.*$)+)/; + CODE = /^((-|=)>)/; + REGEX = /^(\/(.*?)([^\\]|\\\\)\/[imgy]{0,4})/; + MULTI_DENT = /^((\n([ \t]*))+)(\.)?/; + LAST_DENTS = /\n([ \t]*)/g; + LAST_DENT = /\n([ \t]*)/; + ASSIGNMENT = /^(:|=)$/; + // Token cleaning regexes. + JS_CLEANER = /(^`|`$)/g; + MULTILINER = /\n/g; + STRING_NEWLINES = /\n[ \t]*/g; + COMMENT_CLEANER = /(^[ \t]*#|\n[ \t]*$)/mg; + NO_NEWLINE = /^([+\*&|\/\-%=<>:!.\\][<>=&|]*|and|or|is|isnt|not|delete|typeof|instanceof)$/; + HEREDOC_INDENT = /^[ \t]+/g; + // Tokens which a regular expression will never immediately follow, but which + // a division operator might. + // See: http://www.mozilla.org/js/language/js20-2002-04/rationale/syntax.html#regular-expressions + NOT_REGEX = ['IDENTIFIER', 'NUMBER', 'REGEX', 'STRING', ')', '++', '--', ']', '}', 'FALSE', 'NULL', 'TRUE']; + // Tokens which could legitimately be invoked or indexed. + CALLABLE = ['IDENTIFIER', 'SUPER', ')', ']', '}', 'STRING']; + // Scan by attempting to match tokens one character at a time. Slow and steady. + lex.prototype.tokenize = function tokenize(code) { + this.code = code; + // Cleanup code by remove extra line breaks, TODO: chomp + this.i = 0; + // Current character position we're parsing + this.line = 1; + // The current line. + this.indent = 0; + // The current indent level. + this.indents = []; + // The stack of all indent levels we are currently within. + this.tokens = []; + // Collection of all parsed tokens in the form [:TOKEN_TYPE, value] + this.spaced = null; + // The last token that has a space following it. + while (this.i < this.code.length) { + this.chunk = this.code.slice(this.i); + this.extract_next_token(); + } + // sys.puts "original stream: " + this.tokens if process.ENV['VERBOSE'] + this.close_indentation(); + return (new Rewriter()).rewrite(this.tokens); + }; + // At every position, run through this list of attempted matches, + // short-circuiting if any of them succeed. + lex.prototype.extract_next_token = function extract_next_token() { + if (this.identifier_token()) { + return null; + } + if (this.number_token()) { + return null; + } + if (this.heredoc_token()) { + return null; + } + if (this.string_token()) { + return null; + } + if (this.js_token()) { + return null; + } + if (this.regex_token()) { + return null; + } + if (this.indent_token()) { + return null; + } + if (this.comment_token()) { + return null; + } + if (this.whitespace_token()) { + return null; + } + return this.literal_token(); + }; + // Tokenizers ========================================================== + // Matches identifying literals: variables, keywords, method names, etc. + lex.prototype.identifier_token = function identifier_token() { + var id, tag; + if (!((id = this.match(IDENTIFIER, 1)))) { + return false; + } + // Keywords are special identifiers tagged with their own name, + // 'if' will result in an ['IF', "if"] token. + tag = KEYWORDS.indexOf(id) >= 0 ? id.toUpperCase() : 'IDENTIFIER'; + if (tag === 'WHEN' && (this.tag() === 'OUTDENT' || this.tag() === 'INDENT')) { + tag = 'LEADING_WHEN'; + } + if (tag === 'IDENTIFIER' && this.value() === '::') { + this.tag(-1, 'PROTOTYPE_ACCESS'); + } + if (tag === 'IDENTIFIER' && this.value() === '.' && !(this.value(-2) === '.')) { + if (this.tag(-2) === '?') { + this.tag(-1, 'SOAK_ACCESS'); + this.tokens.splice(-2, 1); + } else { + this.tag(-1, 'PROPERTY_ACCESS'); + } + } + this.token(tag, id); + this.i += id.length; + return true; + }; + // Matches numbers, including decimals, hex, and exponential notation. + lex.prototype.number_token = function number_token() { + var number; + if (!((number = this.match(NUMBER, 1)))) { + return false; + } + this.token('NUMBER', number); + this.i += number.length; + return true; + }; + // Matches strings, including multi-line strings. + lex.prototype.string_token = function string_token() { + var escaped, string; + if (!((string = this.match(STRING, 1)))) { + return false; + } + escaped = string.replace(STRING_NEWLINES, " \\\n"); + this.token('STRING', escaped); + this.line += this.count(string, "\n"); + this.i += string.length; + return true; + }; + // Matches heredocs, adjusting indentation to the correct level. + lex.prototype.heredoc_token = function heredoc_token() { + var doc, indent, match; + if (!((match = this.chunk.match(HEREDOC)))) { + return false; + } + doc = match[2] || match[4]; + indent = doc.match(HEREDOC_INDENT).sort()[0]; + doc = doc.replace(new RegExp("^" + indent, 'g'), '').replace(MULTILINER, "\\n").replace('"', '\\"'); + this.token('STRING', '"' + doc + '"'); + this.line += this.count(match[1], "\n"); + this.i += match[1].length; + return true; + }; + // Matches interpolated JavaScript. + lex.prototype.js_token = function js_token() { + var script; + if (!((script = this.match(JS, 1)))) { + return false; + } + this.token('JS', script.replace(JS_CLEANER, '')); + this.i += script.length; + return true; + }; + // Matches regular expression literals. + lex.prototype.regex_token = function regex_token() { + var regex; + if (!((regex = this.match(REGEX, 1)))) { + return false; + } + if (NOT_REGEX.indexOf(this.tag()) >= 0) { + return false; + } + this.token('REGEX', regex); + this.i += regex.length; + return true; + }; + // Matches and conumes comments. + lex.prototype.comment_token = function comment_token() { + var comment; + if (!((comment = this.match(COMMENT, 1)))) { + return false; + } + this.line += comment.match(MULTILINER).length; + this.token('COMMENT', comment.replace(COMMENT_CLEANER, '').split(MULTILINER)); + this.token("\n", "\n"); + this.i += comment.length; + return true; + }; + // Record tokens for indentation differing from the previous line. + lex.prototype.indent_token = function indent_token() { + var diff, indent, next_character, no_newlines, size; + if (!((indent = this.match(MULTI_DENT, 1)))) { + return false; + } + this.line += indent.match(MULTILINER).length; + this.i += indent.length; + next_character = this.chunk.match(MULTI_DENT)[4]; + no_newlines = next_character === '.' || (this.value().match(NO_NEWLINE) && this.tokens[this.tokens.length - 2][0] !== '.' && !this.value().match(CODE)); + if (no_newlines) { + return this.suppress_newlines(indent); + } + size = indent.match(LAST_DENTS).reverse()[0].match(LAST_DENT)[1].length; + if (size === this.indent) { + return this.newline_token(indent); + } + if (size > this.indent) { + diff = size - this.indent; + this.token('INDENT', diff); + this.indents.push(diff); + } else { + this.outdent_token(this.indent - size); + } + this.indent = size; + return true; + }; + // Record an oudent token or tokens, if we're moving back inwards past + // multiple recorded indents. + lex.prototype.outdent_token = function outdent_token(move_out) { + var last_indent; + while (move_out > 0 && this.indents.length) { + last_indent = this.indents.pop(); + this.token('OUTDENT', last_indent); + move_out -= last_indent; + } + this.token("\n", "\n"); + return true; + }; + // Matches and consumes non-meaningful whitespace. + lex.prototype.whitespace_token = function whitespace_token() { + var space; + if (!((space = this.match(WHITESPACE, 1)))) { + return false; + } + this.spaced = this.value(); + this.i += space.length; + return true; + }; + // Multiple newlines get merged together. + // Use a trailing \ to escape newlines. + lex.prototype.newline_token = function newline_token(newlines) { + if (!(this.value() === "\n")) { + this.token("\n", "\n"); + } + return true; + }; + // Tokens to explicitly escape newlines are removed once their job is done. + lex.prototype.suppress_newlines = function suppress_newlines(newlines) { + if (this.value() === "\\") { + this.tokens.pop(); + } + return true; + }; + // We treat all other single characters as a token. Eg.: ( ) , . ! + // Multi-character operators are also literal tokens, so that Racc can assign + // the proper order of operations. + lex.prototype.literal_token = function literal_token() { + var match, tag, value; + match = this.chunk.match(OPERATOR); + value = match && match[1]; + if (value && value.match(CODE)) { + this.tag_parameters(); + } + value = value || this.chunk.substr(0, 1); + tag = value.match(ASSIGNMENT) ? 'ASSIGN' : value; + if (this.value() !== this.spaced && CALLABLE.indexOf(this.tag()) >= 0) { + if (value === '(') { + tag = 'CALL_START'; + } + if (value === '[') { + tag = 'INDEX_START'; + } + } + this.token(tag, value); + this.i += value.length; + return true; + }; + // Helpers ============================================================= + // Add a token to the results, taking note of the line number. + lex.prototype.token = function token(tag, value) { + return this.tokens.push([tag, value]); + // this.tokens.push([tag, Value.new(value, @line)]) + }; + // Look at a tag in the current token stream. + lex.prototype.tag = function tag(index, tag) { + var tok; + if (!((tok = this.tokens[this.tokens.length - (index || 1)]))) { + return null; + } + if ((typeof tag !== "undefined" && tag !== null)) { + return (tok[0] = tag); + } + return tok[0]; + }; + // Look at a value in the current token stream. + lex.prototype.value = function value(index, val) { + var tok; + if (!((tok = this.tokens[this.tokens.length - (index || 1)]))) { + return null; + } + if ((typeof val !== "undefined" && val !== null)) { + return (tok[1] = val); + } + return tok[1]; + }; + // Count the occurences of a character in a string. + lex.prototype.count = function count(string, char) { + var num, pos; + num = 0; + pos = string.indexOf(char); + while (pos !== -1) { + count += 1; + pos = string.indexOf(char, pos + 1); + } + return count; + }; + // Attempt to match a string against the current chunk, returning the indexed + // match. + lex.prototype.match = function match(regex, index) { + var m; + if (!((m = this.chunk.match(regex)))) { + return false; + } + return m ? m[index] : false; + }; + // A source of ambiguity in our grammar was parameter lists in function + // definitions (as opposed to argument lists in function calls). Tag + // parameter identifiers in order to avoid this. Also, parameter lists can + // make use of splats. + lex.prototype.tag_parameters = function tag_parameters() { + var i, tok; + if (this.tag() !== ')') { + return null; + } + i = 0; + while (true) { + i += 1; + tok = this.tokens[this.tokens.length - i]; + if (!tok) { + return null; + } + if (tok[0] === 'IDENTIFIER') { + tok[0] = 'PARAM'; + } else if (tok[0] === ')') { + tok[0] = 'PARAM_END'; + } else if (tok[0] === '(') { + return (tok[0] = 'PARAM_START'); + } + } + return true; + }; + // Close up all remaining open blocks. IF the first token is an indent, + // axe it. + lex.prototype.close_indentation = function close_indentation() { + return this.outdent_token(this.indent); + }; +})(); \ No newline at end of file diff --git a/lib/coffee_script/lexer.rb b/lib/coffee_script/lexer.rb index 620d9733..8ce26df2 100644 --- a/lib/coffee_script/lexer.rb +++ b/lib/coffee_script/lexer.rb @@ -228,8 +228,7 @@ module CoffeeScript # Helpers ========================================================== - # Add a token to the results, taking note of the line number, and - # immediately-preceding comment. + # Add a token to the results, taking note of the line number. def token(tag, value) @tokens << [tag, Value.new(value, @line)] end diff --git a/lib/coffee_script/narwhal/coffee-script.js b/lib/coffee_script/narwhal/coffee-script.js index 02c98cb3..4ccbf55e 100644 --- a/lib/coffee_script/narwhal/coffee-script.js +++ b/lib/coffee_script/narwhal/coffee-script.js @@ -1,5 +1,5 @@ (function(){ - var File, OS, Readline, checkForErrors, coffeePath, factories, loader; + var File, OS, Readline, checkForErrors, coffeePath, factories, loader, puts; // The Narwhal-compatibility wrapper for CoffeeScript. // Require external dependencies. OS = require('os'); @@ -15,6 +15,8 @@ system.stderr.print(coffeeProcess.stderr.read()); throw new Error("CoffeeScript compile error"); }; + // Alias print to "puts", for Node.js compatibility: + puts = print; // Run a simple REPL, round-tripping to the CoffeeScript compiler for every // command. exports.run = function run(args) { diff --git a/lib/coffee_script/nodes.js b/lib/coffee_script/nodes.js new file mode 100644 index 00000000..f059ce06 --- /dev/null +++ b/lib/coffee_script/nodes.js @@ -0,0 +1,34 @@ +(function(){ + exports.Node = function Node() { + var __a; + var arguments = Array.prototype.slice.call(arguments, 0); + __a = this.values = arguments; + return Node === this.constructor ? this : __a; + }; + exports.Expressions = exports.Node; + exports.LiteralNode = exports.Node; + exports.ReturnNode = exports.Node; + exports.CommentNode = exports.Node; + exports.CallNode = exports.Node; + exports.ExtendsNode = exports.Node; + exports.ValueNode = exports.Node; + exports.AccessorNode = exports.Node; + exports.IndexNode = exports.Node; + exports.RangeNode = exports.Node; + exports.SliceNode = exports.Node; + exports.AssignNode = exports.Node; + exports.OpNode = exports.Node; + exports.CodeNode = exports.Node; + exports.SplatNode = exports.Node; + exports.ObjectNode = exports.Node; + exports.ArrayNode = exports.Node; + exports.PushNode = exports.Node; + exports.ClosureNode = exports.Node; + exports.WhileNode = exports.Node; + exports.ForNode = exports.Node; + exports.TryNode = exports.Node; + exports.ThrowNode = exports.Node; + exports.ExistenceNode = exports.Node; + exports.ParentheticalNode = exports.Node; + exports.IfNode = exports.Node; +})(); \ No newline at end of file diff --git a/lib/coffee_script/parser.js b/lib/coffee_script/parser.js new file mode 100644 index 00000000..a03ee696 --- /dev/null +++ b/lib/coffee_script/parser.js @@ -0,0 +1,620 @@ +(function(){ + var Parser, __a, __b, __c, __d, __e, __f, bnf, grammar, name, non_terminal, o, operators, option, parser, part, tokens, unwrap; + var __hasProp = Object.prototype.hasOwnProperty; + Parser = require('jison').Parser; + // DSL =================================================================== + // Detect functions: [ + unwrap = /function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/; + // Quickie DSL for Jison access. + o = function o(pattern_string, func) { + var match; + if (func) { + func = (match = (func + "").match(unwrap)) ? match[1] : '(' + func + '())'; + return [pattern_string, '$$ = ' + func + ';']; + } else { + return [pattern_string, '$$ = $1;']; + } + }; + // Precedence =========================================================== + operators = [["left", '?'], ["right", 'NOT', '!', '!!', '~', '++', '--'], ["left", '*', '/', '%'], ["left", '+', '-'], ["left", '<<', '>>', '>>>'], ["left", '&', '|', '^'], ["left", '<=', '<', '>', '>='], ["right", '==', '!=', 'IS', 'ISNT'], ["left", '&&', '||', 'AND', 'OR'], ["right", '-=', '+=', '/=', '*=', '%='], ["right", 'DELETE', 'INSTANCEOF', 'TYPEOF'], ["left", '.'], ["right", 'INDENT'], ["left", 'OUTDENT'], ["right", 'WHEN', 'LEADING_WHEN', 'IN', 'OF', 'BY'], ["right", 'THROW', 'FOR', 'NEW', 'SUPER'], ["left", 'EXTENDS'], ["left", '||=', '&&=', '?='], ["right", 'ASSIGN', 'RETURN'], ["right", '->', '=>', 'UNLESS', 'IF', 'ELSE', 'WHILE']]; + // Grammar ============================================================== + grammar = { + // All parsing will end in this rule, being the trunk of the AST. + Root: [o("", function() { + return new Expressions(); + }), o("Terminator", function() { + return new Expressions(); + }), o("Expressions"), o("Block Terminator") + ], + // Any list of expressions or method body, seperated by line breaks or semis. + Expressions: [o("Expression", function() { + return Expressions.wrap([$1]); + }), o("Expressions Terminator Expression", function() { + return $1.push($3); + }), o("Expressions Terminator") + ], + // All types of expressions in our language. The basic unit of CoffeeScript + // is the expression. + Expression: [o("Value"), o("Call"), o("Code"), o("Operation"), o("Assign"), o("If"), o("Try"), o("Throw"), o("Return"), o("While"), o("For"), o("Switch"), o("Extends"), o("Splat"), o("Existence"), o("Comment")], + // A block of expressions. Note that the Rewriter will convert some postfix + // forms into blocks for us, by altering the token stream. + Block: [o("INDENT Expressions OUTDENT", function() { + return $2; + }), o("INDENT OUTDENT", function() { + return new Expressions(); + }) + ], + // Tokens that can terminate an expression. + Terminator: [o("\n"), o(";")], + // All hard-coded values. These can be printed straight to JavaScript. + Literal: [o("NUMBER", function() { + return new LiteralNode($1); + }), o("STRING", function() { + return new LiteralNode($1); + }), o("JS", function() { + return new LiteralNode($1); + }), o("REGEX", function() { + return new LiteralNode($1); + }), o("BREAK", function() { + return new LiteralNode($1); + }), o("CONTINUE", function() { + return new LiteralNode($1); + }), o("ARGUMENTS", function() { + return new LiteralNode($1); + }), o("TRUE", function() { + return new LiteralNode(true); + }), o("FALSE", function() { + return new LiteralNode(false); + }), o("YES", function() { + return new LiteralNode(true); + }), o("NO", function() { + return new LiteralNode(false); + }), o("ON", function() { + return new LiteralNode(true); + }), o("OFF", function() { + return new LiteralNode(false); + }) + ], + // Assignment to a variable (or index). + Assign: [o("Value ASSIGN Expression", function() { + return new AssignNode($1, $3); + }) + ], + // Assignment within an object literal (can be quoted). + AssignObj: [o("IDENTIFIER ASSIGN Expression", function() { + return new AssignNode(new ValueNode($1), $3, 'object'); + }), o("STRING ASSIGN Expression", function() { + return new AssignNode(new ValueNode(new LiteralNode($1)), $3, 'object'); + }), o("Comment") + ], + // A return statement. + Return: [o("RETURN Expression", function() { + return new ReturnNode($2); + }), o("RETURN", function() { + return new ReturnNode(new ValueNode(new LiteralNode('null'))); + }) + ], + // A comment. + Comment: [o("COMMENT", function() { + return new CommentNode($1); + }) + ], + // Arithmetic and logical operators + // For Ruby's Operator precedence, see: [ + // https://www.cs.auckland.ac.nz/references/ruby/ProgrammingRuby/language.html + Operation: [o("! Expression", function() { + return new OpNode($1, $2); + }), o("!! Expression", function() { + return new OpNode($1, $2); + }), o("- Expression", function() { + return new OpNode($1, $2); + }), o("+ Expression", function() { + return new OpNode($1, $2); + }), o("NOT Expression", function() { + return new OpNode($1, $2); + }), o("~ Expression", function() { + return new OpNode($1, $2); + }), o("-- Expression", function() { + return new OpNode($1, $2); + }), o("++ Expression", function() { + return new OpNode($1, $2); + }), o("DELETE Expression", function() { + return new OpNode($1, $2); + }), o("TYPEOF Expression", function() { + return new OpNode($1, $2); + }), o("Expression --", function() { + return new OpNode($2, $1, null, true); + }), o("Expression ++", function() { + return new OpNode($2, $1, null, true); + }), o("Expression * Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression / Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression % Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression + Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression - Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression << Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression >> Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression >>> Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression & Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression | Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression ^ Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression <= Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression < Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression > Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression >= Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression == Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression != Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression IS Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression ISNT Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression && Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression || Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression AND Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression OR Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression ? Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression -= Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression += Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression /= Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression *= Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression %= Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression ||= Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression &&= Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression ?= Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression INSTANCEOF Expression", function() { + return new OpNode($2, $1, $3); + }), o("Expression IN Expression", function() { + return new OpNode($2, $1, $3); + }) + ], + // Try abbreviated expressions to make the grammar build faster: + // UnaryOp: [ + // o "!" + // o "!!" + // o "NOT" + // o "~" + // o "--" + // o "++" + // o "DELETE" + // o "TYPEOF" + // ] + // + // BinaryOp: [ + // o "*" + // o "/" + // o "%" + // o "+" + // o "-" + // o "<<" + // o ">>" + // o ">>>" + // o "&" + // o "|" + // o "^" + // o "<=" + // o "<" + // o ">" + // o ">=" + // o "==" + // o "!=" + // o "IS" + // o "ISNT" + // o "&&" + // o "||" + // o "AND" + // o "OR" + // o "?" + // o "-=" + // o "+=" + // o "/=" + // o "*=" + // o "%=" + // o "||=" + // o "&&=" + // o "?=" + // o "INSTANCEOF" + // o "IN" + // ] + // + // Operation: [ + // o "Expression BinaryOp Expression", -> new OpNode($2, $1, $3) + // o "UnaryOp Expression", -> new OpNode($1, $2) + // ] + // The existence operator. + Existence: [o("Expression ?", function() { + return new ExistenceNode($1); + }) + ], + // Function definition. + Code: [o("PARAM_START ParamList PARAM_END FuncGlyph Block", function() { + return new CodeNode($2, $5, $4); + }), o("FuncGlyph Block", function() { + return new CodeNode([], $2, $1); + }) + ], + // The symbols to signify functions, and bound functions. + FuncGlyph: [o("->", function() { + return 'func'; + }), o("=>", function() { + return 'boundfunc'; + }) + ], + // The parameters to a function definition. + ParamList: [o("Param", function() { + return [$1]; + }), o("ParamList , Param", function() { + return $1.push($3); + }) + ], + // A Parameter (or ParamSplat) in a function definition. + Param: [o("PARAM"), o("PARAM . . .", function() { + return new SplatNode($1); + }) + ], + // A regular splat. + Splat: [o("Expression . . .", function() { + return new SplatNode($1); + }) + ], + // Expressions that can be treated as values. + Value: [o("IDENTIFIER", function() { + return new ValueNode($1); + }), o("Literal", function() { + return new ValueNode($1); + }), o("Array", function() { + return new ValueNode($1); + }), o("Object", function() { + return new ValueNode($1); + }), o("Parenthetical", function() { + return new ValueNode($1); + }), o("Range", function() { + return new ValueNode($1); + }), o("Value Accessor", function() { + return $1.push($2); + }), o("Invocation Accessor", function() { + return new ValueNode($1, [$2]); + }) + ], + // Accessing into an object or array, through dot or index notation. + Accessor: [o("PROPERTY_ACCESS IDENTIFIER", function() { + return new AccessorNode($2); + }), o("PROTOTYPE_ACCESS IDENTIFIER", function() { + return new AccessorNode($2, 'prototype'); + }), o("SOAK_ACCESS IDENTIFIER", function() { + return new AccessorNode($2, 'soak'); + }), o("Index"), o("Slice", function() { + return new SliceNode($1); + }) + ], + // Indexing into an object or array. + Index: [o("INDEX_START Expression INDEX_END", function() { + return new IndexNode($2); + }) + ], + // An object literal. + Object: [o("{ AssignList }", function() { + return new ObjectNode($2); + }) + ], + // Assignment within an object literal (comma or newline separated). + AssignList: [o("", function() { + return []; + }), o("AssignObj", function() { + return [$1]; + }), o("AssignList , AssignObj", function() { + return $1.push($3); + }), o("AssignList Terminator AssignObj", function() { + return $1.push($3); + }), o("AssignList , Terminator AssignObj", function() { + return $1.push($4); + }), o("INDENT AssignList OUTDENT", function() { + return $2; + }) + ], + // All flavors of function call (instantiation, super, and regular). + Call: [o("Invocation", function() { + return $1; + }), o("NEW Invocation", function() { + return $2.new_instance(); + }), o("Super", function() { + return $1; + }) + ], + // Extending an object's prototype. + Extends: [o("Value EXTENDS Value", function() { + return new ExtendsNode($1, $3); + }) + ], + // A generic function invocation. + Invocation: [o("Value Arguments", function() { + return new CallNode($1, $2); + }), o("Invocation Arguments", function() { + return new CallNode($1, $2); + }) + ], + // The list of arguments to a function invocation. + Arguments: [o("CALL_START ArgList CALL_END", function() { + return $2; + }) + ], + // Calling super. + Super: [o("SUPER CALL_START ArgList CALL_END", function() { + return new CallNode('super', $3); + }) + ], + // The range literal. + Range: [o("[ Expression . . Expression ]", function() { + return new RangeNode($2, $5); + }), o("[ Expression . . . Expression ]", function() { + return new RangeNode($2, $6, true); + }) + ], + // The slice literal. + Slice: [o("INDEX_START Expression . . Expression INDEX_END", function() { + return new RangeNode($2, $5); + }), o("INDEX_START Expression . . . Expression INDEX_END", function() { + return new RangeNode($2, $6, true); + }) + ], + // The array literal. + Array: [o("[ ArgList ]", function() { + return new ArrayNode($2); + }) + ], + // A list of arguments to a method call, or as the contents of an array. + ArgList: [o("", function() { + return []; + }), o("Expression", function() { + return val; + }), o("INDENT Expression", function() { + return [$2]; + }), o("ArgList , Expression", function() { + return $1.push($3); + }), o("ArgList Terminator Expression", function() { + return $1.push($3); + }), o("ArgList , Terminator Expression", function() { + return $1.push($4); + }), o("ArgList , INDENT Expression", function() { + return $1.push($4); + }), o("ArgList OUTDENT", function() { + return $1; + }) + ], + // Just simple, comma-separated, required arguments (no fancy syntax). + SimpleArgs: [o("Expression", function() { + return $1; + }), o("SimpleArgs , Expression", function() { + return ([$1].push($3)).reduce(function(a, b) { + return a.concat(b); + }); + }) + ], + // Try/catch/finally exception handling blocks. + Try: [o("TRY Block Catch", function() { + return new TryNode($2, $3[0], $3[1]); + }), o("TRY Block FINALLY Block", function() { + return new TryNode($2, nil, nil, $4); + }), o("TRY Block Catch FINALLY Block", function() { + return new TryNode($2, $3[0], $3[1], $5); + }) + ], + // A catch clause. + Catch: [o("CATCH IDENTIFIER Block", function() { + return [$2, $3]; + }) + ], + // Throw an exception. + Throw: [o("THROW Expression", function() { + return new ThrowNode($2); + }) + ], + // Parenthetical expressions. + Parenthetical: [o("( Expression )", function() { + return new ParentheticalNode($2); + }) + ], + // The while loop. (there is no do..while). + While: [o("WHILE Expression Block", function() { + return new WhileNode($2, $3); + }), o("WHILE Expression", function() { + return new WhileNode($2, nil); + }), o("Expression WHILE Expression", function() { + return new WhileNode($3, Expressions.wrap($1)); + }) + ], + // Array comprehensions, including guard and current index. + // Looks a little confusing, check nodes.rb for the arguments to ForNode. + For: [o("Expression FOR ForVariables ForSource", function() { + return new ForNode($1, $4, $3[0], $3[1]); + }), o("FOR ForVariables ForSource Block", function() { + return new ForNode($4, $3, $2[0], $2[1]); + }) + ], + // An array comprehension has variables for the current element and index. + ForVariables: [o("IDENTIFIER", function() { + return [$1]; + }), o("IDENTIFIER , IDENTIFIER", function() { + return [$1, $3]; + }) + ], + // The source of the array comprehension can optionally be filtered. + ForSource: [o("IN Expression", function() { + return { + source: $2 + }; + }), o("OF Expression", function() { + return { + source: $2, + object: true + }; + }), o("ForSource WHEN Expression", function() { + $1.filter = $3; + return $1; + }), o("ForSource BY Expression", function() { + $1.step = $3; + return $1; + }) + ], + // Switch/When blocks. + Switch: [o("SWITCH Expression INDENT Whens OUTDENT", function() { + return $4.rewrite_condition($2); + }), o("SWITCH Expression INDENT Whens ELSE Block OUTDENT", function() { + return $4.rewrite_condition($2).add_else($6); + }) + ], + // The inner list of whens. + Whens: [o("When", function() { + return $1; + }), o("Whens When", function() { + return $1.push($2); + }) + ], + // An individual when. + When: [o("LEADING_WHEN SimpleArgs Block", function() { + return new IfNode($2, $3, nil, { + statement: true + }); + }), o("LEADING_WHEN SimpleArgs Block Terminator", function() { + return new IfNode($2, $3, nil, { + statement: true + }); + }), o("Comment Terminator When", function() { + return $3.add_comment($1); + }) + ], + // The most basic form of "if". + IfBlock: [o("IF Expression Block", function() { + return new IfNode($2, $3); + }) + ], + // An elsif portion of an if-else block. + ElsIf: [o("ELSE IfBlock", function() { + return $2.force_statement(); + }) + ], + // Multiple elsifs can be chained together. + ElsIfs: [o("ElsIf", function() { + return $1; + }), o("ElsIfs ElsIf", function() { + return $1.add_else($2); + }) + ], + // Terminating else bodies are strictly optional. + ElseBody: [o("", function() { + return null; + }), o("ELSE Block", function() { + return $2; + }) + ], + // All the alternatives for ending an if-else block. + IfEnd: [o("ElseBody", function() { + return $1; + }), o("ElsIfs ElseBody", function() { + return $1.add_else($2); + }) + ], + // The full complement of if blocks, including postfix one-liner ifs and unlesses. + If: [o("IfBlock IfEnd", function() { + return $1.add_else($2); + }), o("Expression IF Expression", function() { + return new IfNode($3, Expressions.wrap($1), nil, { + statement: true + }); + }), o("Expression UNLESS Expression", function() { + return new IfNode($3, Expressions.wrap($1), nil, { + statement: true, + invert: true + }); + }) + ] + }; + // Helpers ============================================================== + // Make the Jison parser. + bnf = { + }; + tokens = []; + __a = grammar; + for (name in __a) { + non_terminal = __a[name]; + if (__hasProp.call(__a, name)) { + bnf[name] = (function() { + __b = []; __c = non_terminal; + for (__d = 0; __d < __c.length; __d++) { + option = __c[__d]; + __b.push((function() { + __e = option[0].split(" "); + for (__f = 0; __f < __e.length; __f++) { + part = __e[__f]; + !grammar[part] ? tokens.push(part) : null; + } + name === "Root" ? (option[1] = "return " + option[1]) : null; + return option; + }).call(this)); + } + return __b; + }).call(this); + } + } + tokens = tokens.join(" "); + parser = new Parser({ + tokens: tokens, + bnf: bnf, + operators: operators + }, { + debug: false + }); + // Thin wrapper around the real lexer + parser.lexer = { + lex: function lex() { + var token; + token = this.tokens[this.pos] || [""]; + this.pos += 1; + // this.yylineno: token and token[1] and token[1][1] + this.yytext = token[1]; + return token[0]; + }, + setInput: function setInput(tokens) { + this.tokens = tokens; + return this.pos = 0; + }, + upcomingInput: function upcomingInput() { + return ""; + }, + showPosition: function showPosition() { + return this.pos; + } + }; + exports.Parser = function Parser() { }; + exports.Parser.prototype.parse = function parse(tokens) { + return parser.parse(tokens); + }; +})(); \ No newline at end of file diff --git a/lib/coffee_script/parser.rb b/lib/coffee_script/parser.rb index 5aa620c6..d66a470b 100644 --- a/lib/coffee_script/parser.rb +++ b/lib/coffee_script/parser.rb @@ -10,7 +10,7 @@ module CoffeeScript class Parser < Racc::Parser -module_eval(<<'...end grammar.y/module_eval...', 'grammar.y', 464) +module_eval(<<'...end grammar.y/module_eval...', 'grammar.y', 461) # Lex and parse a CoffeeScript. def parse(code) # Uncomment the following line to enable grammar debugging, in combination @@ -34,347 +34,350 @@ module_eval(<<'...end grammar.y/module_eval...', 'grammar.y', 464) ##### State transition tables begin ### clist = [ -'134,194,142,28,31,35,40,44,46,52,57,61,64,103,104,105,181,115,103,104', -'105,299,101,270,102,286,287,101,158,102,58,65,130,135,195,146,149,150', -'55,262,55,164,8,14,170,158,47,50,290,199,158,196,146,149,153,156,160', -'146,149,153,156,160,163,167,129,133,138,141,145,148,152,155,159,162', -'166,128,132,137,140,144,147,151,154,157,161,165,127,131,136,139,143', -'171,55,180,8,14,201,26,278,32,36,12,42,204,28,31,35,40,44,46,52,57,61', -'64,187,199,262,12,2,212,213,21,25,47,199,55,97,43,293,209,53,58,65,66', -'94,265,206,207,7,13,311,22,97,33,37,97,55,47,50,185,94,286,287,94,71', -'74,5,10,16,19,8,14,201,34,39,55,262,198,47,8,14,201,289,47,8,14,294', -'8,14,55,8,14,190,97,47,120,95,47,97,95,282,94,55,72,3,55,94,280,26,279', -'32,36,12,42,81,28,31,35,40,44,46,52,57,61,64,277,8,14,124,2,8,14,21', -'25,81,47,8,14,43,158,47,53,58,65,66,208,-185,-185,257,7,13,55,22,158', -'33,37,72,3,47,50,146,149,153,156,160,71,74,5,10,16,19,158,212,213,34', -'39,316,78,146,149,153,156,160,163,167,129,133,138,141,145,148,152,155', -'159,162,166,128,132,137,312,158,78,179,211,72,3,219,-185,-185,26,124', -'32,36,12,42,109,28,31,35,40,44,46,52,57,61,64,103,104,105,,2,,,21,25', -'101,,102,,43,158,,53,58,65,66,,146,149,,7,13,,22,158,33,37,158,,47,50', -'-185,-185,,-185,-185,71,74,5,10,16,19,158,,,34,39,,,146,149,153,156', -'160,163,167,129,133,138,141,145,148,152,155,159,162,166,128,132,137', -'103,104,105,,,72,3,,,101,26,102,32,36,12,42,,28,31,35,40,44,46,52,57', -'61,64,103,104,105,,2,,,21,25,101,,102,,43,158,,53,58,65,66,,146,149', -',7,13,,22,158,33,37,158,,47,50,-185,-185,,-185,-185,71,74,5,10,16,19', -'158,,,34,39,,,146,149,153,156,160,163,167,129,133,138,141,145,148,152', -'155,159,162,166,128,132,137,103,104,105,,,72,3,,,101,26,102,32,36,12', -'42,,28,31,35,40,44,46,52,57,61,64,,,158,,2,,,21,25,-185,-185,,,43,158', -',53,58,65,66,,-185,-185,,7,13,,22,,33,37,,,47,50,8,14,190,,188,71,74', -'5,10,16,19,158,,,34,39,,,146,149,153,156,160,163,167,129,133,138,141', -'145,148,152,155,159,162,166,128,132,137,,,,,,72,3,,,,26,,32,36,12,42', -',28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,', -',,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,158,,,34,39,,,146,149', -'153,156,160,163,167,129,133,138,141,145,148,152,155,159,162,166,128', -'132,137,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64', -',,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,', -'71,74,5,10,16,19,158,,,34,39,,,146,149,153,156,160,163,167,129,133,138', -'141,145,148,152,155,159,162,166,128,132,137,,,,,,72,3,,,,26,,32,36,12', -'42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66', -',,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,158,,,34,39,,,146', -'149,153,156,160,163,167,129,133,138,141,145,148,152,155,159,162,166', -'128,132,137,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61', -'64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,', -',,,71,74,5,10,16,19,158,,,34,39,,,146,149,153,156,160,163,167,129,133', -'138,141,145,148,152,155,159,162,166,128,132,137,,,,,,72,3,,,,26,,32', -'36,12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58', -'65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,158,,,34,39', -',,146,149,153,156,160,163,167,129,133,138,141,145,148,,,,,,,,,,,,,,72', -'3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,', -',,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19', -'158,,,34,39,,,146,149,153,156,160,163,167,129,133,138,141,145,148,,', -',,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,', -',,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71', -'74,5,10,16,19,158,,,34,39,,,146,149,153,156,160,163,167,129,133,138', -'141,145,148,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46', -'52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,', -',47,50,,,,,,71,74,5,10,16,19,158,,,34,39,,,146,149,153,156,160,163,167', -'129,133,138,141,145,148,,,,,,,,,302,,,,,72,3,,,,26,,32,36,12,42,,28', -'31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7', -'13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,158,,,34,39,,,146,149,153', -'156,160,163,167,129,133,138,158,,,,,,,146,149,153,156,160,163,167,,', -'72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25', -',,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16', -'19,158,,,34,39,,,146,149,153,156,160,163,167,129,133,138,158,,,,,,,146', -'149,153,156,160,163,167,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46', -'52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,', -',47,50,,,,,,71,74,5,10,16,19,158,,,34,39,,,146,149,153,156,160,163,167', -'129,133,138,158,,,,,,,146,149,153,156,160,163,167,,,72,3,,,,26,,32,36', -'12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65', -'66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,', -',,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52', -'57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47', -'50,112,,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72', -'3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,', -',,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19', -',,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31', -'35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13', -',22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,', -',,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,', -',2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71', -'74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36', -'12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65', -'66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,', -',,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52', -'57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47', -'50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,', -',,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43', -',,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34', -'39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40', -'44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33', -'37,,,47,50,,121,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,', -',,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,', -'21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,274,,,,,71,74', -'5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,8,14,,26,,32,36', -'12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65', -'66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,', -',,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52', -'57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47', -'50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,', -',,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43', -',,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34', -'39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40', -'44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33', -'37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,', -',,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21', -'25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10', -'16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,', -'28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,', -',7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,', -',,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61', -'64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,', -',,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26', -',32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53', -'58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39', -',,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44', -'46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37', -',,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72', -'3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,', -',,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19', -',,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31', -'35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13', -',22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,', -',,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,', -',2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71', -'74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36', -'12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65', -'66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,', -',,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52', -'57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47', -'50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,', -',,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43', -',,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34', -'39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40', -'44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33', -'37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,', -',,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21', -'25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10', -'16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,', -'28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,', -',7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,', -',,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61', -'64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,', -',,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26', -',32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53', -'58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39', -',,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44', -'46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37', -',,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72', -'3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,', -',,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19', -',,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31', -'35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13', -',22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,', -',,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,', -',2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71', -'74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36', -'12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65', -'66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,', -',,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52', -'57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47', -'50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,', -',,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43', -',,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,112,,,,,71,74,5,10,16,19,', -',,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35', -'40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22', -',33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,', -',,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,', -',21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5', -'10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42', -',28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,', -',,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,', -',,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61', -'64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,', -',,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26', -',32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53', -'58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39', -',,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44', -'46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37', -',,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72', -'3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,', -',,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19', -',,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31', -'35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13', -',22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,', -',,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,', -',2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71', -'74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36', -'12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65', -'66,,,,,7,13,,22,,33,37,,,47,50,112,,,,,71,74,5,10,16,19,,,,34,39,,,', -',,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46', -'52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,', -',47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72', -'3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,', -',,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,55,,,,,71,74,5,10,16', -'19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,8,14,,26,,32,36,12,42,', -'28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,', -',7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,', -',,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61', -'64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,', -',,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26', -',32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53', -'58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39', -',,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44', -'46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37', -',,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72', -'3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,', -',,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19', -',,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31', -'35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13', -',22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,', -',,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52,57,61,64,,,', -',2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71', -'74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36', -'12,42,,28,31,35,40,44,46,52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65', -'66,,,,,7,13,,22,,33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,,', -',,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,36,12,42,,28,31,35,40,44,46,52', -'57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,,,,7,13,,22,,33,37,,,47', -'50,134,,142,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,130,135,,,,150', -',,,164,,,72,3,,,,26,158,32,36,,42,,,146,149,153,156,160,163,167,129', -'133,138,141,145,148,152,155,159,162,166,128,132,137,140,144,147,151', -'154,157,161,165,127,131,136,139,143,134,,142,,,,,,,,321,,,,,,,,,,,,', -',,,,,,,,,130,135,,,,150,,,,164,,,,,,,,,158,,,,,,,146,149,153,156,160', -'163,167,129,133,138,141,145,148,152,155,159,162,166,128,132,137,140', -'144,147,151,154,157,161,165,127,131,136,139,143,28,31,35,40,44,46,52', -'57,61,64,315,,,,2,,,21,25,,,,,43,,,53,58,65,,,,,,,13,,22,,33,37,,,47', -'50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,28,31,35,40,44,46,52,57,61,64', -',,,,2,,,21,25,,,,,43,72,3,53,58,65,26,,32,36,,42,13,,22,,33,37,,,47', -'50,,,,,,71,74,5,10,28,31,35,40,44,46,52,57,61,64,,,,,,,,,,,,,,,,,,58', -'65,,,,,,,72,3,,,,26,,32,36,50,42,,,,,,,,,,,,,,,,,,28,31,35,40,44,46', -'52,57,61,64,,,,,2,,,21,25,,,,,43,,,53,58,65,66,,26,,32,36,13,42,22,', -'33,37,,,47,50,,,,,,71,74,5,10,16,19,,,,34,39,,,,,28,31,35,40,44,46,52', -'57,61,64,,,,,2,,,21,25,,,,,43,72,3,53,58,65,26,,32,36,,42,13,,22,,33', -'37,,,47,50,134,,142,,,71,74,5,10,16,19,,,,34,39,,,,,,,,,,,,,,,,,130', -'135,,,,150,,,,164,,,72,3,,,,26,158,32,36,,42,,,146,149,153,156,160,163', -'167,129,133,138,141,145,148,152,155,159,162,166,128,132,137,140,144', -'147,151,154,157,161,165,127,131,136,139,143,134,,142,,,,,,,,,,,,,,,', -',,,,,,,,,,,,,,130,135,,,,150,,,,164,,,,,,,,,158,,,,,,,146,149,153,156', -'160,163,167,129,133,138,141,145,148,152,155,159,162,166,128,132,137', -'140,144,147,151,154,157,161,165,127,131,136,139,143,134,,142,,,,,,,', -',,,,,,,,,,,,,,,,,,,,,,130,135,,,,150,,,,164,,,,,,,,,158,,,,,,,146,149', -'153,156,160,163,167,129,133,138,141,145,148,152,155,159,162,166,128', -'132,137,140,144,147,151,154,157,161,165,127,131,136,139,143,134,,142', -',,,,,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,,,150,,,,164,,,,,,,,,158,,,,,', -',146,149,153,156,160,163,167,129,133,138,141,145,148,152,155,159,162', -'166,128,132,137,140,144,147,151,154,157,161,165,127,131,136,139,143', -'134,,142,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,,,150,,,,164,,,,,,,,', -'158,,,,,,,146,149,153,156,160,163,167,129,133,138,141,145,148,152,155', -'159,162,166,128,132,137,140,144,147,151,154,157,161,165,127,131,136', -'139,143,134,,142,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,,,150,,,,164', -',,,,,,,,158,,,,,,,146,149,153,156,160,163,167,129,133,138,141,145,148', -'152,155,159,162,166,128,132,137,140,144,147,151,154,157,161,165,127', -'131,136,139,143,134,,142,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,,,150', -',,,164,,,,,,,,,158,,,,,,,146,149,153,156,160,163,167,129,133,138,141', -'145,148,152,155,159,162,166,128,132,137,140,144,147,151,154,157,161', -'165,127,202,136,139,143,134,,142,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,130,135', -',,,150,,,,164,,,,,,,,,158,,,,,,,146,149,153,156,160,163,167,129,133', -'138,141,145,148,152,155,159,162,166,128,132,137,140,144,147,151,154', -'157,161,165,127,131,136,139,143,134,,142,,,,,,,,,,,,,,,,,,,,,,,,,,,', -',,130,135,,,,150,,,,164,,,,,,,,,158,,,,,,,146,149,153,156,160,163,167', -'129,133,138,141,145,148,152,155,159,162,166,128,132,137,140,144,147', -'151,154,157,161,165,127,131,136,139,143,134,,142,,,,,,,,,,,,,,,,,,,', -',,,,,,,,,,130,135,,,,150,,,,164,,,,,,,,,158,,,,,,,146,149,153,156,160', -'163,167,129,133,138,141,145,148,152,155,159,162,166,128,132,137,140', -'144,147,151,154,157,161,165,127,131,136,139,143,134,,142,,,,,,,,,,,', -',,,,,,,,,,,,,,,,,,130,135,,,,150,,,,164,,,,,,,,,158,,,,,,,146,149,153', -'156,160,163,167,129,133,138,141,145,148,152,155,159,162,166,128,132', -'137,140,144,147,151,154,157,161,165,127,131,136,139,143,134,,142,,,', -',,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,,,150,,,,164,,,,,,,,,158,,,,,,,146', -'149,153,156,160,163,167,129,133,138,141,145,148,152,155,159,162,166', -'128,132,137,140,144,147,151,154,157,161,165,127,131,136,139,143,134', -',142,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,,,150,,,,164,,,,,,,,,158', -',,,,,,146,149,153,156,160,163,167,129,133,138,141,145,148,152,155,159', -'162,166,128,132,137,140,144,147,151,154,157,161,165,127,131,136,139', -'143,134,,142,,,,,,,,,,,,,,,,,,,,,,,272,,,,,,,130,135,,,,150,,,,164,', -',,,,,,,158,,,,,,,146,149,153,156,160,163,167,129,133,138,141,145,148', -'152,155,159,162,166,128,132,137,140,144,147,151,154,157,161,165,127', -'271,136,139,143,134,,142,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,,,150', -',,,164,,,,,,,,,158,,,,,,,146,149,153,156,160,163,167,129,133,138,141', -'145,148,152,155,159,162,166,128,132,137,140,144,147,151,154,157,161', -'165,127,131,136,139,143,134,,142,,,,,,,,,,,,,,,,,,,,,,,320,,,,,,,130', -'135,,,,150,,,,164,,,,,,,,,158,,,,,,,146,149,153,156,160,163,167,129', -'133,138,141,145,148,152,155,159,162,166,128,132,137,140,144,147,151', -'154,157,161,165,127,131,136,139,143,134,,142,,,,,,,,,,,,,,,,,,,,,,,', -',,,,,,130,135,,,,150,,,,164,,,,,,,,,158,,,,,,,146,149,153,156,160,163', -'167,129,133,138,141,145,148,152,155,159,162,166,128,132,137,140,144', -'147,151,154,157,161,165,127,131,136,139,143,134,,142,,,,,,,,,,,,,,,', -',,,,,,,,,,,,,,130,135,,,,150,,,,164,,,,,,,184,,158,,,,,,,146,149,153', -'156,160,163,167,129,133,138,141,145,148,152,155,159,162,166,128,132', -'137,140,144,147,151,154,157,161,165,127,131,136,139,143,134,,142,,,', -',,,,,,,,,,,,,,,,,,,322,,,,,,,130,135,,,,150,,,,164,,,,,,,,,158,,,,,', -',146,149,153,156,160,163,167,129,133,138,141,145,148,152,155,159,162', -'166,128,132,137,140,144,147,151,154,157,161,165,127,131,136,139,143', -'134,,142,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,,,150,,,,164,,,,,,,55', -',158,,,,,,,146,149,153,156,160,163,167,129,133,138,141,145,148,152,155', -'159,162,166,128,132,137,140,144,147,151,154,157,161,165,127,131,136', -'139,143,134,,142,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,,,150,,,,164', -',,,,,,,,158,,,,,,,146,149,153,156,160,163,167,129,133,138,141,145,148', -'152,155,159,162,166,128,132,137,140,144,147,151,154,157,161,165,127', -'131,136,139,143,134,,142,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,,,150', -',,,164,,,,,,,55,,158,,,,,,,146,149,153,156,160,163,167,129,133,138,141', -'145,148,152,155,159,162,166,128,132,137,140,144,147,151,154,157,161', -'165,127,131,136,139,143,130,135,,,,,,,,164,,,,,,,,,158,,,,,,,146,149', -'153,156,160,163,167,129,133,138,141,145,148,152,155,159,162,166,128', -'132,137,140,144,147,151,154,157,161,165,127,131,136,139,143,130,135', -',,,,,,,164,,,,,,,,,158,,,,,,,146,149,153,156,160,163,167,129,133,138', -'141,145,148,152,155,159,162,166,128,132,137,140,144,147,151,154,157', -'161,165,127,131,136,139,143,130,135,,,,,,,,164,,,,,,,,,158,,,,,,,146', -'149,153,156,160,163,167,129,133,138,141,145,148,152,155,159,162,166', -'128,132,137,140,144,147,151,154,157,161,165,127,131,130,135,,,,,,,,164', -',,,,,,,,158,,,,,,,146,149,153,156,160,163,167,129,133,138,141,145,148', -'152,155,159,162,166,128,132,137,140,144,147,151,154,157,161,165,127', -'131,130,135,,,,,,,,164,,,,,,,,,158,,,,,,,146,149,153,156,160,163,167', -'129,133,138,141,145,148,152,155,159,162,166,128,132,137,140,144,147', -'151,154,157,161,165,127,131,130,135,,,,,,,,164,,,,,,,,,158,,,,,,,146', -'149,153,156,160,163,167,129,133,138,141,145,148,152,155,159,162,166', -'128,132,137,140,144,147,151,154,157,161,165,127,131,135,,,,,,,,164,', -',,,,,,,158,,,,,,,146,149,153,156,160,163,167,129,133,138,141,145,148', -'152,155,159,162,166,128,132,137,140,144,147,151,154,157,161,165,127', -'131,135,,,,,,,,164,,,,,,,,,158,,,,,,,146,149,153,156,160,163,167,129', -'133,138,141,145,148,152,155,159,162,166,128,132,137,140,144,147,151', -'154,157,161,165,127,131,135,,,,,,,,164,,,,,,,,,158,,,,,,,146,149,153', -'156,160,163,167,129,133,138,141,145,148,152,155,159,162,166,128,132', -'137,140,144,147,151,154,157,161,165,127,131,135,,,,,,,,164,,,,,,,,,158', -',,,,,,146,149,153,156,160,163,167,129,133,138,141,145,148,152,155,159', -'162,166,128,132,137,140,144,147,151,154,157,161,165,127,131,135,,,,', -',,,164,,,,,,,,,158,,,,,,,146,149,153,156,160,163,167,129,133,138,141', -'145,148,152,155,159,162,166,128,132,137,140,144,147,151,154,157,161', -'165,127,131,164,,,,,,,,,158,,,,,,,146,149,153,156,160,163,167,129,133', -'138,141,145,148,152,155,159,162,166,128,132,137,140,144,147,151,154', -'157,161,165,127,164,,,,,,,,,158,,,,,,,146,149,153,156,160,163,167,129', -'133,138,141,145,148,152,155,159,162,166,128,132,137,140,144,147,151', -'154,157,161,165,127,164,,,,,,,,,158,,,,,,,146,149,153,156,160,163,167', -'129,133,138,141,145,148,152,155,159,162,166,128,132,137,140,144,147', -'151,154,157,161,165,127,158,,,,,,,146,149,153,156,160,163,167,129,133', -'138,141,145,148,152,155,159,162,166,128,132,137,140,144,147,151,154', -'157,161,165,127,158,,,,,,,146,149,153,156,160,163,167,129,133,138,141', -'145,148,152,155,159,162,166,128,132,137,140,144,147,151,154,157,161', -'165,127,158,,,,,,,146,149,153,156,160,163,167,129,133,138,141,145,148', -'152,155,159,162,166,128,132,137,140,144,147,151,154,157,161,165,127', -'158,,,,,,,146,149,153,156,160,163,167,129,133,138,141,145,148,152,155', -'159,162,166,128,132,137,140,144,147,151,154,157,161,165,127,158,,,,', -',,146,149,153,156,160,163,167,129,133,138,141,145,148,152,155,159,162', -'166,128,132,137,140,144,147,151,154,157,161,165,127' ] - racc_action_table = arr = Array.new(10938, nil) +'134,198,142,28,31,34,38,42,45,51,56,61,64,96,114,181,59,103,104,105', +'299,94,270,290,286,287,101,262,102,109,57,65,130,135,262,49,289,151', +'59,146,150,165,49,146,150,8,14,200,54,198,185,59,197,212,213,179,49', +'146,150,154,157,160,162,164,129,133,138,141,145,149,153,156,159,163', +'167,128,132,137,140,144,148,152,155,158,161,166,127,131,136,139,143', +'147,180,8,14,200,12,26,311,32,35,12,40,204,28,31,34,38,42,45,51,56,61', +'64,293,278,59,209,2,286,287,21,25,146,150,59,96,41,266,186,52,57,65', +'66,94,-185,-185,59,7,13,120,22,198,33,36,59,146,150,49,54,206,207,262', +'194,71,74,5,10,16,19,49,8,14,295,282,44,47,-185,-185,49,8,14,8,14,190', +'96,8,14,190,250,188,96,96,94,-185,-185,8,14,200,94,94,8,14,72,3,-185', +'-185,59,26,59,32,35,12,40,195,28,31,34,38,42,45,51,56,61,64,81,8,14', +'49,2,97,196,21,25,49,49,97,280,41,-185,-185,52,57,65,66,-185,-185,8', +'14,7,13,279,22,277,33,36,-185,-185,78,49,54,124,103,104,105,71,74,5', +'10,16,19,101,316,102,59,312,44,47,146,150,154,157,160,162,164,129,133', +'138,141,145,149,153,156,170,171,8,14,103,104,105,72,3,-185,-185,72,3', +'101,78,102,26,208,32,35,12,40,257,28,31,34,38,42,45,51,56,61,64,103', +'104,105,211,2,212,213,21,25,101,124,102,81,41,,,52,57,65,66,,,,,7,13', +',22,,33,36,,,,49,54,,103,104,105,71,74,5,10,16,19,101,,102,,,44,47,146', +'150,154,157,160,162,164,129,133,138,141,145,149,153,156,159,163,167', +'128,132,137,140,144,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51', +'56,61,64,103,104,105,,2,,,21,25,101,,102,,41,,,52,57,65,66,,,,,7,13', +',22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,146,150,154,157', +'160,162,164,129,133,138,141,145,149,153,156,159,163,167,128,132,137', +'140,144,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,', +',,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71', +'74,5,10,16,19,,,,,,44,47,146,150,154,157,160,162,164,129,133,138,141', +'145,149,153,156,159,163,167,128,132,137,140,144,,,,72,3,,,,26,,32,35', +'12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65', +'66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,146', +'150,154,157,160,162,164,129,133,138,141,145,149,153,156,159,163,167', +'128,132,137,140,144,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51', +'56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49', +'54,,,,,71,74,5,10,16,19,,,,,,44,47,146,150,154,157,160,162,164,129,133', +'138,141,145,149,153,156,159,163,167,128,132,137,140,144,,,,72,3,,,,26', +',32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52', +'57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47', +'146,150,154,157,160,162,164,129,133,138,141,145,149,153,156,159,163', +'167,128,132,137,140,144,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45', +'51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,', +',,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,146,150,154,157,160,162,164', +'129,133,138,141,145,149,153,156,159,163,167,128,132,137,140,144,,,,72', +'3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,', +',,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19', +',,,,,44,47,146,150,154,157,160,162,164,129,133,138,141,145,149,153,156', +'159,163,167,128,132,137,140,144,,,,72,3,,,,26,,32,35,12,40,,28,31,34', +'38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22', +',33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,146,150,154,157,160', +'162,164,129,133,138,141,145,149,153,156,146,150,154,157,160,162,164', +'129,133,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,', +',2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71', +'74,5,10,16,19,,,,,,44,47,146,150,154,157,160,162,164,129,133,138,141', +'145,149,153,156,146,150,154,157,160,162,164,129,133,,,72,3,,,,26,,32', +'35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57', +'65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,302,44,47', +'146,150,154,157,160,162,164,129,133,138,141,145,149,153,156,146,150', +'154,157,160,162,164,129,133,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42', +'45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36', +',,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,146,150,154,157,160,162,164', +'129,133,146,150,154,157,160,162,164,129,133,146,150,154,157,160,162', +'164,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,', +'21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5', +'10,16,19,,,,,,44,47,146,150,154,157,160,162,164,129,133,146,150,154', +'157,160,162,164,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45', +'51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,', +',,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72', +'3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,', +',,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,112,,,,71,74,5,10,16', +'19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28', +'31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7', +'13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,', +',,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64', +',,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,', +'71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32', +'35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57', +'65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,', +',,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45', +'51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,', +',,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72', +'3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,', +',,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19', +',,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31', +'34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13', +',22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,', +',,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,', +',2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71', +'74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35', +'12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65', +'66,,,,,7,13,,22,,33,36,,,,49,54,,122,,,71,74,5,10,16,19,,,,,,44,47,', +',,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45', +'51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,', +',,49,54,275,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,', +',72,3,8,14,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21', +'25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10', +'16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,', +'28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,', +',7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,', +',,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61', +'64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,', +',,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26', +',32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52', +'57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47', +',,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45', +'51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,', +',,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72', +'3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,', +',,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19', +',,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31', +'34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13', +',22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,', +',,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,', +',2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71', +'74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35', +'12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65', +'66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,', +',,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51', +'56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49', +'54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,', +',26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41', +',,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,', +',44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38', +'42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33', +'36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,', +',,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21', +'25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10', +'16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,', +'28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,', +',7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,', +',,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61', +'64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,', +',,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26', +',32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52', +'57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47', +',,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45', +'51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,', +',,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72', +'3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,', +',,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19', +',,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31', +'34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13', +',22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,', +',,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,', +',2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71', +'74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35', +'12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65', +'66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,', +',,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51', +'56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49', +'54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,', +',26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41', +',,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,', +',44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38', +'42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33', +'36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,', +',,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21', +'25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10', +'16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,', +'28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,', +',7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,', +',,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61', +'64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,112', +',,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26', +',32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52', +'57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47', +',,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45', +'51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,', +',,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72', +'3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,', +',,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19', +',,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31', +'34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13', +',22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,', +',,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,', +',2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71', +'74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35', +'12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65', +'66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,', +',,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51', +'56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49', +'54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,', +',26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41', +',,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,', +',44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38', +'42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33', +'36,,,,49,54,112,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,', +',,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,', +'21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,59,,,,71,74', +'5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,8,14,,26,,32,35', +'12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65', +'66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,', +',,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51', +'56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49', +'54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,', +',26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41', +',,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,', +',44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38', +'42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33', +'36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,', +',,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21', +'25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10', +'16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,', +'28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,', +',7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,', +',,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61', +'64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,', +',,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26', +',32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52', +'57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,44,47', +',,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31,34,38,42,45', +'51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13,,22,,33,36,', +',,49,54,,,,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72', +'3,,,,26,,32,35,12,40,,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,', +',,41,,,52,57,65,66,,,,,7,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19', +',,,,,44,47,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,12,40,,28,31', +'34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,7,13', +',22,,33,36,,,,49,54,134,,142,,71,74,5,10,16,19,,,,,,44,47,,,,,,,,,,', +',,,,,130,135,,,,151,,,,165,,72,3,,,,26,,32,35,,40,,,,146,150,154,157', +'160,162,164,129,133,138,141,145,149,153,156,159,163,167,128,132,137', +'140,144,148,152,155,158,161,166,127,131,136,139,143,147,134,,142,,,', +',,,321,,,,,,,,,,,,,,,,,,,,,,,130,135,,,,151,,,,165,,,,,,,,,,,,,,,,146', +'150,154,157,160,162,164,129,133,138,141,145,149,153,156,159,163,167', +'128,132,137,140,144,148,152,155,158,161,166,127,131,136,139,143,147', +',,,,,,,,,315,28,31,34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52', +'57,65,,,,,,,13,,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,,,,,,,', +',,,,,,,,,,,,,,,,,,,,,72,3,,,,26,,32,35,,40,28,31,34,38,42,45,51,56,61', +'64,,,,,2,,,21,25,,,,,41,,,52,57,65,66,,,,,,13,,22,,33,36,,,,49,54,,', +',,71,74,5,10,16,19,,,,,,44,47,,28,31,34,38,42,45,51,56,61,64,,,,,,,', +',,,,,,,,72,3,57,65,,26,,32,35,,40,,,,,,,,,,54,,,,,,,,,,,,,,,,,,28,31', +'34,38,42,45,51,56,61,64,,,,,2,,,21,25,,,,,41,,,52,57,65,,,26,,32,35', +'13,40,22,,33,36,,,,49,54,,,,,71,74,5,10,16,19,,,,,,,,,,28,31,34,38,42', +'45,51,56,61,64,,,,,2,,,21,25,,,,,41,72,3,52,57,65,26,,32,35,,40,13,', +'22,,33,36,,,,49,54,134,,142,,71,74,5,10,16,19,,,,,,,,,,,,,,,,,,,,,,', +'130,135,,,,151,,,,165,,72,3,,,,26,,32,35,,40,,,,146,150,154,157,160', +'162,164,129,133,138,141,145,149,153,156,159,163,167,128,132,137,140', +'144,148,152,155,158,161,166,127,131,136,139,143,147,134,,142,,,,,,,', +',,,,,,,,,,,,,,,,,,,,,,130,135,,,,151,,,,165,,,,,,,,,,,,,,,,146,150,154', +'157,160,162,202,129,133,138,141,145,149,153,156,159,163,167,128,132', +'137,140,144,148,152,155,158,161,166,127,131,136,139,143,147,134,,142', +',,,,,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,,,151,,,,165,,,,,,,,,,,,,,,,146', +'150,154,157,160,162,164,129,133,138,141,145,149,153,156,159,163,167', +'128,132,137,140,144,148,152,155,158,161,166,127,131,136,139,143,147', +'134,,142,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,,,151,,,,165,,,,,,,,', +',,,,,,,146,150,154,157,160,162,164,129,133,138,141,145,149,153,156,159', +'163,167,128,132,137,140,144,148,152,155,158,161,166,127,131,136,139', +'143,147,134,,142,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,,,151,,,,165', +',,,,,,,,,,,,,,,146,150,154,157,160,162,164,129,133,138,141,145,149,153', +'156,159,163,167,128,132,137,140,144,148,152,155,158,161,166,127,131', +'136,139,143,147,134,,142,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,,,151', +',,,165,,,,,,,,,,,,,,,,146,150,154,157,160,162,164,129,133,138,141,145', +'149,153,156,159,163,167,128,132,137,140,144,148,152,155,158,161,166', +'127,131,136,139,143,147,134,,142,,,,,,,,,,,,,,,,,,,,,,,320,,,,,,,130', +'135,,,,151,,,,165,,,,,,,,,,,,,,,,146,150,154,157,160,162,164,129,133', +'138,141,145,149,153,156,159,163,167,128,132,137,140,144,148,152,155', +'158,161,166,127,131,136,139,143,147,134,,142,,,,,,,,,,,,,,,,,,,,,,,', +',,,,,,130,135,,,,151,,,,165,,,,,,,,,,,,,,,,146,150,154,157,160,162,164', +'129,133,138,141,145,149,153,156,159,163,167,128,132,137,140,144,148', +'152,155,158,161,166,127,131,136,139,143,147,134,,142,,,,,,,,,,,,,,,', +',,,,,,,271,,,,,,,130,135,,,,151,,,,165,,,,,,,,,,,,,,,,146,150,154,157', +'160,162,272,129,133,138,141,145,149,153,156,159,163,167,128,132,137', +'140,144,148,152,155,158,161,166,127,131,136,139,143,147,134,,142,,,', +',,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,,,151,,,,165,,,,,,,,,,,,,,,,146,150', +'154,157,160,162,164,129,133,138,141,145,149,153,156,159,163,167,128', +'132,137,140,144,148,152,155,158,161,166,127,131,136,139,143,147,134', +',142,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,,,151,,,,165,,,,,,,,,,,,', +',,,146,150,154,157,160,162,164,129,133,138,141,145,149,153,156,159,163', +'167,128,132,137,140,144,148,152,155,158,161,166,127,131,136,139,143', +'147,134,,142,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,,,151,,,,165,,,,', +',,,,,,,,,,,146,150,154,157,160,162,164,129,133,138,141,145,149,153,156', +'159,163,167,128,132,137,140,144,148,152,155,158,161,166,127,131,136', +'139,143,147,134,,142,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,,,151,,,', +'165,,,,,,,,,,,,,,,,146,150,154,157,160,162,164,129,133,138,141,145,149', +'153,156,159,163,167,128,132,137,140,144,148,152,155,158,161,166,127', +'131,136,139,143,147,134,,142,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,', +',151,,,,165,,,,,,,,,,,,,,,,146,150,154,157,160,162,164,129,133,138,141', +'145,149,153,156,159,163,167,128,132,137,140,144,148,152,155,158,161', +'166,127,131,136,139,143,147,134,,142,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,130', +'135,,,,151,,,,165,,,,,,,,,,,,,,,,146,150,154,157,160,162,164,129,133', +'138,141,145,149,153,156,159,163,167,128,132,137,140,144,148,152,155', +'158,161,166,127,131,136,139,143,147,134,,142,,,,,,,,,,,,,,,,,,,,,,,', +',,,,,,130,135,,,,151,,,,165,,,,,,,,,,,,,,,,146,150,154,157,160,162,164', +'129,133,138,141,145,149,153,156,159,163,167,128,132,137,140,144,148', +'152,155,158,161,166,127,131,136,139,143,147,134,,142,,,,,,,,,,,,,,,', +',,,,,,,322,,,,,,,130,135,,,,151,,,,165,,,,,,,,,,,,,,,,146,150,154,157', +'160,162,164,129,133,138,141,145,149,153,156,159,163,167,128,132,137', +'140,144,148,152,155,158,161,166,127,131,136,139,143,147,134,,142,,,', +',,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,,,151,,,,165,,,,,,,,59,,,,,,,,146', +'150,154,157,160,162,164,129,133,138,141,145,149,153,156,159,163,167', +'128,132,137,140,144,148,152,155,158,161,166,127,131,136,139,143,147', +'134,,142,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,,,151,,,,165,,,,,,,,', +',,,,,,,146,150,154,157,160,162,164,129,133,138,141,145,149,153,156,159', +'163,167,128,132,137,140,144,148,152,155,158,161,166,127,131,136,139', +'143,147,134,,142,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,,,151,,,,165', +',,,,,,,59,,,,,,,,146,150,154,157,160,162,164,129,133,138,141,145,149', +'153,156,159,163,167,128,132,137,140,144,148,152,155,158,161,166,127', +'131,136,139,143,147,134,,142,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,130,135,,', +',151,,,,165,,,,,,,,,,,,,,,,146,150,154,157,160,162,164,129,133,138,141', +'145,149,153,156,159,163,167,128,132,137,140,144,148,152,155,158,161', +'166,127,131,136,139,143,147,134,,142,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,130', +'135,,,,151,,,,165,,,,,,,,184,,,,,,,,146,150,154,157,160,162,164,129', +'133,138,141,145,149,153,156,159,163,167,128,132,137,140,144,148,152', +'155,158,161,166,127,131,136,139,143,147,130,135,,,,,,,,165,,,,,,,,,', +',,,,,,146,150,154,157,160,162,164,129,133,138,141,145,149,153,156,159', +'163,167,128,132,137,140,144,148,152,155,158,161,166,127,131,136,139', +'143,147,130,135,,,,,,,,165,,,,,,,,,,,,,,,,146,150,154,157,160,162,164', +'129,133,138,141,145,149,153,156,159,163,167,128,132,137,140,144,148', +'152,155,158,161,166,127,131,136,139,143,147,130,135,,,,,,,,165,,,,,', +',,,,,,,,,,146,150,154,157,160,162,164,129,133,138,141,145,149,153,156', +'159,163,167,128,132,137,140,144,148,152,155,158,161,166,127,131,136', +'139,143,147,135,,,,,,,,165,,,,,,,,,,,,,,,,146,150,154,157,160,162,164', +'129,133,138,141,145,149,153,156,159,163,167,128,132,137,140,144,148', +'152,155,158,161,166,127,131,136,139,143,147,135,,,,,,,,165,,,,,,,,,', +',,,,,,146,150,154,157,160,162,164,129,133,138,141,145,149,153,156,159', +'163,167,128,132,137,140,144,148,152,155,158,161,166,127,131,136,139', +'143,147,135,,,,,,,,165,,,,,,,,,,,,,,,,146,150,154,157,160,162,164,129', +'133,138,141,145,149,153,156,159,163,167,128,132,137,140,144,148,152', +'155,158,161,166,127,131,136,139,143,147,135,,,,,,,,165,,,,,,,,,,,,,', +',,146,150,154,157,160,162,164,129,133,138,141,145,149,153,156,159,163', +'167,128,132,137,140,144,148,152,155,158,161,166,127,131,136,139,143', +'147,135,,,,,,,,165,,,,,,,,,,,,,,,,146,150,154,157,160,162,164,129,133', +'138,141,145,149,153,156,159,163,167,128,132,137,140,144,148,152,155', +'158,161,166,127,131,136,139,143,147,165,,,,,,,,,,,,,,,,146,150,154,157', +'160,162,164,129,133,138,141,145,149,153,156,159,163,167,128,132,137', +'140,144,148,152,155,158,161,166,127,131,136,139,143,147,165,,,,,,,,', +',,,,,,,146,150,154,157,160,162,164,129,133,138,141,145,149,153,156,159', +'163,167,128,132,137,140,144,148,152,155,158,161,166,127,131,136,139', +'143,147,165,,,,,,,,,,,,,,,,146,150,154,157,160,162,164,129,133,138,141', +'145,149,153,156,159,163,167,128,132,137,140,144,148,152,155,158,161', +'166,127,131,136,139,143,147,146,150,154,157,160,162,164,129,133,138', +'141,145,149,153,156,159,163,167,128,132,137,140,144,148,152,155,158', +'161,166,127,131,136,139,143,147,146,150,154,157,160,162,164,129,133', +'138,141,145,149,153,156,159,163,167,128,132,137,140,144,148,152,155', +'158,161,166,127,131,136,139,143,147,146,150,154,157,160,162,164,129', +'133,138,141,145,149,153,156,159,163,167,128,132,137,140,144,148,152', +'155,158,161,166,127,131,136,139,143,147,146,150,154,157,160,162,164', +'129,133,138,141,145,149,153,156,159,163,167,128,132,137,140,144,148', +'152,155,158,161,166,127,131,136,139,143,147,146,150,154,157,160,162', +'164,129,133,138,141,145,149,153,156,159,163,167,128,132,137,140,144', +'148,152,155,158,161,166,127,131,136,139,143,147,146,150,154,157,160', +'162,164,129,133,138,141,145,149,153,156,159,163,167,128,132,137,140', +'144,148,152,155,158,161,166,127,131,136,139,143,147,146,150,154,157', +'160,162,164,129,133,138,141,145,149,153,156,159,163,167,128,132,137', +'140,144,148,152,155,158,161,166,127,131,136,139,143,147,146,150,154', +'157,160,162,164,129,133,138,141,145,149,153,156,159,163,167,128,132', +'137,140,144,148,152,155,158,161,166,127,131,136,139,143,147' ] + racc_action_table = arr = Array.new(10987, nil) idx = 0 clist.each do |str| str.split(',', -1).each do |i| @@ -384,379 +387,382 @@ clist = [ end clist = [ -'117,103,117,21,21,21,21,21,21,21,21,21,21,70,70,70,82,37,30,30,30,271', -'70,191,70,214,214,30,239,30,21,21,117,117,104,239,239,117,214,292,259', -'117,67,67,70,249,292,21,257,191,117,105,249,249,249,249,249,117,117', -'117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117', -'117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,70,296,82', -'191,191,191,21,203,21,21,144,21,117,144,144,144,144,144,144,144,144', -'144,144,97,113,184,78,144,218,218,144,144,184,203,279,190,144,261,122', -'144,144,144,144,190,186,118,118,144,144,296,144,26,144,144,95,280,144', -'144,94,26,288,288,95,144,144,144,144,144,144,113,113,113,144,144,78', -'261,113,190,203,203,203,219,261,122,122,261,62,62,43,186,186,186,189', -'26,54,26,95,269,95,211,189,207,144,144,293,269,206,144,205,144,144,299', -'144,2,299,299,299,299,299,299,299,299,299,299,202,190,190,66,299,260', -'260,299,299,180,189,310,310,299,89,269,299,299,299,299,120,89,89,179', -'299,299,69,299,253,299,299,181,181,299,299,253,253,253,253,253,299,299', -'299,299,299,299,216,125,125,299,299,309,75,216,216,216,216,216,216,216', -'216,216,216,216,216,216,216,216,216,216,216,216,216,216,299,83,1,81', -'124,299,299,131,83,83,299,130,299,299,5,299,32,5,5,5,5,5,5,5,5,5,5,254', -'254,254,,5,,,5,5,254,,254,,5,242,,5,5,5,5,,242,242,,5,5,,5,173,5,5,88', -',5,5,173,173,,88,88,5,5,5,5,5,5,228,,,5,5,,,228,228,228,228,228,228', -'228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,255,255', -'255,,,5,5,,,255,5,255,5,5,7,5,,7,7,7,7,7,7,7,7,7,7,91,91,91,,7,,,7,7', -'91,,91,,7,246,,7,7,7,7,,246,246,,7,7,,7,85,7,7,116,,7,7,85,85,,116,116', -'7,7,7,7,7,7,237,,,7,7,,,237,237,237,237,237,237,237,237,237,237,237', -'237,237,237,237,237,237,237,237,237,237,90,90,90,,,7,7,,,90,7,90,7,7', -'10,7,,10,10,10,10,10,10,10,10,10,10,,,174,,10,,,10,10,174,174,,,10,111', -',10,10,10,10,,111,111,,10,10,,10,,10,10,,,10,10,99,99,99,,99,10,10,10', -'10,10,10,252,,,10,10,,,252,252,252,252,252,252,252,252,252,252,252,252', -'252,252,252,252,252,252,252,252,252,,,,,,10,10,,,,10,,10,10,12,10,,12', -'12,12,12,12,12,12,12,12,12,,,,,12,,,12,12,,,,,12,,,12,12,12,12,,,,,12', -'12,,12,,12,12,,,12,12,,,,,,12,12,12,12,12,12,232,,,12,12,,,232,232,232', +'115,111,115,170,170,170,170,170,170,170,170,170,170,269,36,82,259,254', +'254,254,272,269,191,257,214,214,254,184,254,32,170,170,115,115,292,184', +'250,115,214,246,246,115,292,243,243,111,111,111,170,191,94,296,111,218', +'218,81,269,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115', +'115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115', +'115,115,115,82,191,191,191,78,170,296,170,170,143,170,115,143,143,143', +'143,143,143,143,143,143,143,261,203,279,121,143,288,288,143,143,240', +'240,280,190,143,187,96,143,143,143,143,190,88,88,41,143,143,53,143,203', +'143,143,78,248,248,143,143,116,116,261,103,143,143,143,143,143,143,261', +'121,121,261,211,143,143,117,117,190,62,62,187,187,187,26,99,99,99,164', +'99,97,189,26,118,118,203,203,203,97,189,310,310,143,143,173,173,293', +'143,207,143,143,299,143,104,299,299,299,299,299,299,299,299,299,299', +'2,190,190,26,299,26,105,299,299,97,189,97,206,299,174,174,299,299,299', +'299,89,89,67,67,299,299,205,299,202,299,299,83,83,75,299,299,66,70,70', +'70,299,299,299,299,299,299,70,309,70,69,299,299,299,249,249,249,249', +'249,249,249,249,249,249,249,249,249,249,249,70,70,260,260,255,255,255', +'181,181,85,85,299,299,255,1,255,299,120,299,299,5,299,179,5,5,5,5,5', +'5,5,5,5,5,30,30,30,124,5,125,125,5,5,30,130,30,180,5,,,5,5,5,5,,,,,5', +'5,,5,,5,5,,,,5,5,,90,90,90,5,5,5,5,5,5,90,,90,,,5,5,244,244,244,244', +'244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244', +'244,244,,,,5,5,,,,5,,5,5,7,5,,7,7,7,7,7,7,7,7,7,7,91,91,91,,7,,,7,7', +'91,,91,,7,,,7,7,7,7,,,,,7,7,,7,,7,7,,,,7,7,,,,,7,7,7,7,7,7,,,,,,7,7', '232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232', -'232,,,,,,12,12,,,,12,,12,12,13,12,,13,13,13,13,13,13,13,13,13,13,,,', -',13,,,13,13,,,,,13,,,13,13,13,13,,,,,13,13,,13,,13,13,,,13,13,,,,,,13', -'13,13,13,13,13,234,,,13,13,,,234,234,234,234,234,234,234,234,234,234', -'234,234,234,234,234,234,234,234,234,234,234,,,,,,13,13,,,,13,,13,13', -'16,13,,16,16,16,16,16,16,16,16,16,16,,,,,16,,,16,16,,,,,16,,,16,16,16', -'16,,,,,16,16,,16,,16,16,,,16,16,,,,,,16,16,16,16,16,16,220,,,16,16,', -',220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220', -'220,220,220,220,,,,,,16,16,,,,16,,16,16,19,16,,19,19,19,19,19,19,19', -'19,19,19,,,,,19,,,19,19,,,,,19,,,19,19,19,19,,,,,19,19,,19,,19,19,,', -'19,19,,,,,,19,19,19,19,19,19,225,,,19,19,,,225,225,225,225,225,225,225', -'225,225,225,225,225,225,225,225,225,225,225,225,225,225,,,,,,19,19,', -',,19,,19,19,287,19,,287,287,287,287,287,287,287,287,287,287,,,,,287', -',,287,287,,,,,287,,,287,287,287,287,,,,,287,287,,287,,287,287,,,287', -'287,,,,,,287,287,287,287,287,287,245,,,287,287,,,245,245,245,245,245', -'245,245,245,245,245,245,245,245,,,,,,,,,,,,,,287,287,,,,287,,287,287', -'22,287,,22,22,22,22,22,22,22,22,22,22,,,,,22,,,22,22,,,,,22,,,22,22', -'22,22,,,,,22,22,,22,,22,22,,,22,22,,,,,,22,22,22,22,22,22,238,,,22,22', -',,238,238,238,238,238,238,238,238,238,238,238,238,238,,,,,,,,,,,,,,22', -'22,,,,22,,22,22,286,22,,286,286,286,286,286,286,286,286,286,286,,,,', -'286,,,286,286,,,,,286,,,286,286,286,286,,,,,286,286,,286,,286,286,,', -'286,286,,,,,,286,286,286,286,286,286,248,,,286,286,,,248,248,248,248', -'248,248,248,248,248,248,248,248,248,,,,,,,,,,,,,,286,286,,,,286,,286', -'286,277,286,,277,277,277,277,277,277,277,277,277,277,,,,,277,,,277,277', -',,,,277,,,277,277,277,277,,,,,277,277,,277,,277,277,,,277,277,,,,,,277', -'277,277,277,277,277,241,,,277,277,,,241,241,241,241,241,241,241,241', -'241,241,241,241,241,,,,,,,,,277,,,,,277,277,,,,277,,277,277,275,277', -',275,275,275,275,275,275,275,275,275,275,,,,,275,,,275,275,,,,,275,', -',275,275,275,275,,,,,275,275,,275,,275,275,,,275,275,,,,,,275,275,275', -'275,275,275,235,,,275,275,,,235,235,235,235,235,235,235,235,235,235', -'217,,,,,,,217,217,217,217,217,217,217,,,275,275,,,,275,,275,275,274', -'275,,274,274,274,274,274,274,274,274,274,274,,,,,274,,,274,274,,,,,274', -',,274,274,274,274,,,,,274,274,,274,,274,274,,,274,274,,,,,,274,274,274', -'274,274,274,229,,,274,274,,,229,229,229,229,229,229,229,229,229,229', -'226,,,,,,,226,226,226,226,226,226,226,,,274,274,,,,274,,274,274,33,274', -',33,33,33,33,33,33,33,33,33,33,,,,,33,,,33,33,,,,,33,,,33,33,33,33,', -',,,33,33,,33,,33,33,,,33,33,,,,,,33,33,33,33,33,33,233,,,33,33,,,233', -'233,233,233,233,233,233,233,233,233,221,,,,,,,221,221,221,221,221,221', -'221,,,33,33,,,,33,,33,33,34,33,,34,34,34,34,34,34,34,34,34,34,,,,,34', -',,34,34,,,,,34,,,34,34,34,34,,,,,34,34,,34,,34,34,,,34,34,,,,,,34,34', -'34,34,34,34,,,,34,34,,,,,,,,,,,,,,,,,,,,,,,,,,,,,34,34,,,,34,,34,34', -'36,34,,36,36,36,36,36,36,36,36,36,36,,,,,36,,,36,36,,,,,36,,,36,36,36', -'36,,,,,36,36,,36,,36,36,,,36,36,36,,,,,36,36,36,36,36,36,,,,36,36,,', -',,,,,,,,,,,,,,,,,,,,,,,,,,36,36,,,,36,,36,36,262,36,,262,262,262,262', -'262,262,262,262,262,262,,,,,262,,,262,262,,,,,262,,,262,262,262,262', -',,,,262,262,,262,,262,262,,,262,262,,,,,,262,262,262,262,262,262,,,', -'262,262,,,,,,,,,,,,,,,,,,,,,,,,,,,,,262,262,,,,262,,262,262,39,262,', -'39,39,39,39,39,39,39,39,39,39,,,,,39,,,39,39,,,,,39,,,39,39,39,39,,', -',,39,39,,39,,39,39,,,39,39,,,,,,39,39,39,39,39,39,,,,39,39,,,,,,,,,', -',,,,,,,,,,,,,,,,,,,39,39,,,,39,,39,39,42,39,,42,42,42,42,42,42,42,42', -'42,42,,,,,42,,,42,42,,,,,42,,,42,42,42,42,,,,,42,42,,42,,42,42,,,42', -'42,,,,,,42,42,42,42,42,42,,,,42,42,,,,,,,,,,,,,,,,,,,,,,,,,,,,,42,42', -',,,42,,42,42,213,42,,213,213,213,213,213,213,213,213,213,213,,,,,213', -',,213,213,,,,,213,,,213,213,213,213,,,,,213,213,,213,,213,213,,,213', -'213,,,,,,213,213,213,213,213,213,,,,213,213,,,,,,,,,,,,,,,,,,,,,,,,', -',,,,213,213,,,,213,,213,213,53,213,,53,53,53,53,53,53,53,53,53,53,,', -',,53,,,53,53,,,,,53,,,53,53,53,53,,,,,53,53,,53,,53,53,,,53,53,,,,,', -'53,53,53,53,53,53,,,,53,53,,,,,,,,,,,,,,,,,,,,,,,,,,,,,53,53,,,,53,', -'53,53,128,53,,128,128,128,128,128,128,128,128,128,128,,,,,128,,,128', -'128,,,,,128,,,128,128,128,128,,,,,128,128,,128,,128,128,,,128,128,,', -',,,128,128,128,128,128,128,,,,128,128,,,,,,,,,,,,,,,,,,,,,,,,,,,,,128', -'128,,,,128,,128,128,55,128,,55,55,55,55,55,55,55,55,55,55,,,,,55,,,55', -'55,,,,,55,,,55,55,55,55,,,,,55,55,,55,,55,55,,,55,55,,55,,,,55,55,55', -'55,55,55,,,,55,55,,,,,,,,,,,,,,,,,,,,,,,,,,,,,55,55,,,,55,,55,55,201', -'55,,201,201,201,201,201,201,201,201,201,201,,,,,201,,,201,201,,,,,201', -',,201,201,201,201,,,,,201,201,,201,,201,201,,,201,201,201,,,,,201,201', -'201,201,201,201,,,,201,201,,,,,,,,,,,,,,,,,,,,,,,,,,,,,201,201,201,201', -',201,,201,201,200,201,,200,200,200,200,200,200,200,200,200,200,,,,,200', -',,200,200,,,,,200,,,200,200,200,200,,,,,200,200,,200,,200,200,,,200', -'200,,,,,,200,200,200,200,200,200,,,,200,200,,,,,,,,,,,,,,,,,,,,,,,,', -',,,,200,200,,,,200,,200,200,187,200,,187,187,187,187,187,187,187,187', -'187,187,,,,,187,,,187,187,,,,,187,,,187,187,187,187,,,,,187,187,,187', -',187,187,,,187,187,,,,,,187,187,187,187,187,187,,,,187,187,,,,,,,,,', -',,,,,,,,,,,,,,,,,,,187,187,,,,187,,187,187,185,187,,185,185,185,185', -'185,185,185,185,185,185,,,,,185,,,185,185,,,,,185,,,185,185,185,185', -',,,,185,185,,185,,185,185,,,185,185,,,,,,185,185,185,185,185,185,,,', -'185,185,,,,,,,,,,,,,,,,,,,,,,,,,,,,,185,185,,,,185,,185,185,171,185', -',171,171,171,171,171,171,171,171,171,171,,,,,171,,,171,171,,,,,171,', -',171,171,171,171,,,,,171,171,,171,,171,171,,,171,171,,,,,,171,171,171', -'171,171,171,,,,171,171,,,,,,,,,,,,,,,,,,,,,,,,,,,,,171,171,,,,171,,171', -'171,167,171,,167,167,167,167,167,167,167,167,167,167,,,,,167,,,167,167', -',,,,167,,,167,167,167,167,,,,,167,167,,167,,167,167,,,167,167,,,,,,167', -'167,167,167,167,167,,,,167,167,,,,,,,,,,,,,,,,,,,,,,,,,,,,,167,167,', -',,167,,167,167,71,167,,71,71,71,71,71,71,71,71,71,71,,,,,71,,,71,71', -',,,,71,,,71,71,71,71,,,,,71,71,,71,,71,71,,,71,71,,,,,,71,71,71,71,71', -'71,,,,71,71,,,,,,,,,,,,,,,,,,,,,,,,,,,,,71,71,,,,71,,71,71,74,71,,74', -'74,74,74,74,74,74,74,74,74,,,,,74,,,74,74,,,,,74,,,74,74,74,74,,,,,74', -'74,,74,,74,74,,,74,74,,,,,,74,74,74,74,74,74,,,,74,74,,,,,,,,,,,,,,', -',,,,,,,,,,,,,,74,74,,,,74,,74,74,166,74,,166,166,166,166,166,166,166', -'166,166,166,,,,,166,,,166,166,,,,,166,,,166,166,166,166,,,,,166,166', -',166,,166,166,,,166,166,,,,,,166,166,166,166,166,166,,,,166,166,,,,', -',,,,,,,,,,,,,,,,,,,,,,,,166,166,,,,166,,166,166,165,166,,165,165,165', -'165,165,165,165,165,165,165,,,,,165,,,165,165,,,,,165,,,165,165,165', -'165,,,,,165,165,,165,,165,165,,,165,165,,,,,,165,165,165,165,165,165', -',,,165,165,,,,,,,,,,,,,,,,,,,,,,,,,,,,,165,165,,,,165,,165,165,164,165', -',164,164,164,164,164,164,164,164,164,164,,,,,164,,,164,164,,,,,164,', -',164,164,164,164,,,,,164,164,,164,,164,164,,,164,164,,,,,,164,164,164', -'164,164,164,,,,164,164,,,,,,,,,,,,,,,,,,,,,,,,,,,,,164,164,,,,164,,164', -'164,163,164,,163,163,163,163,163,163,163,163,163,163,,,,,163,,,163,163', -',,,,163,,,163,163,163,163,,,,,163,163,,163,,163,163,,,163,163,,,,,,163', -'163,163,163,163,163,,,,163,163,,,,,,,,,,,,,,,,,,,,,,,,,,,,,163,163,', -',,163,,163,163,162,163,,162,162,162,162,162,162,162,162,162,162,,,,', -'162,,,162,162,,,,,162,,,162,162,162,162,,,,,162,162,,162,,162,162,,', -'162,162,,,,,,162,162,162,162,162,162,,,,162,162,,,,,,,,,,,,,,,,,,,,', -',,,,,,,,162,162,,,,162,,162,162,161,162,,161,161,161,161,161,161,161', -'161,161,161,,,,,161,,,161,161,,,,,161,,,161,161,161,161,,,,,161,161', -',161,,161,161,,,161,161,,,,,,161,161,161,161,161,161,,,,161,161,,,,', -',,,,,,,,,,,,,,,,,,,,,,,,161,161,,,,161,,161,161,160,161,,160,160,160', -'160,160,160,160,160,160,160,,,,,160,,,160,160,,,,,160,,,160,160,160', -'160,,,,,160,160,,160,,160,160,,,160,160,,,,,,160,160,160,160,160,160', -',,,160,160,,,,,,,,,,,,,,,,,,,,,,,,,,,,,160,160,,,,160,,160,160,159,160', -',159,159,159,159,159,159,159,159,159,159,,,,,159,,,159,159,,,,,159,', -',159,159,159,159,,,,,159,159,,159,,159,159,,,159,159,,,,,,159,159,159', -'159,159,159,,,,159,159,,,,,,,,,,,,,,,,,,,,,,,,,,,,,159,159,,,,159,,159', -'159,157,159,,157,157,157,157,157,157,157,157,157,157,,,,,157,,,157,157', -',,,,157,,,157,157,157,157,,,,,157,157,,157,,157,157,,,157,157,,,,,,157', -'157,157,157,157,157,,,,157,157,,,,,,,,,,,,,,,,,,,,,,,,,,,,,157,157,', -',,157,,157,157,156,157,,156,156,156,156,156,156,156,156,156,156,,,,', -'156,,,156,156,,,,,156,,,156,156,156,156,,,,,156,156,,156,,156,156,,', -'156,156,,,,,,156,156,156,156,156,156,,,,156,156,,,,,,,,,,,,,,,,,,,,', -',,,,,,,,156,156,,,,156,,156,156,155,156,,155,155,155,155,155,155,155', -'155,155,155,,,,,155,,,155,155,,,,,155,,,155,155,155,155,,,,,155,155', -',155,,155,155,,,155,155,,,,,,155,155,155,155,155,155,,,,155,155,,,,', -',,,,,,,,,,,,,,,,,,,,,,,,155,155,,,,155,,155,155,154,155,,154,154,154', -'154,154,154,154,154,154,154,,,,,154,,,154,154,,,,,154,,,154,154,154', -'154,,,,,154,154,,154,,154,154,,,154,154,,,,,,154,154,154,154,154,154', -',,,154,154,,,,,,,,,,,,,,,,,,,,,,,,,,,,,154,154,,,,154,,154,154,153,154', -',153,153,153,153,153,153,153,153,153,153,,,,,153,,,153,153,,,,,153,', -',153,153,153,153,,,,,153,153,,153,,153,153,,,153,153,,,,,,153,153,153', -'153,153,153,,,,153,153,,,,,,,,,,,,,,,,,,,,,,,,,,,,,153,153,,,,153,,153', -'153,152,153,,152,152,152,152,152,152,152,152,152,152,,,,,152,,,152,152', -',,,,152,,,152,152,152,152,,,,,152,152,,152,,152,152,,,152,152,,,,,,152', -'152,152,152,152,152,,,,152,152,,,,,,,,,,,,,,,,,,,,,,,,,,,,,152,152,', -',,152,,152,152,151,152,,151,151,151,151,151,151,151,151,151,151,,,,', -'151,,,151,151,,,,,151,,,151,151,151,151,,,,,151,151,,151,,151,151,,', -'151,151,,,,,,151,151,151,151,151,151,,,,151,151,,,,,,,,,,,,,,,,,,,,', -',,,,,,,,151,151,,,,151,,151,151,150,151,,150,150,150,150,150,150,150', -'150,150,150,,,,,150,,,150,150,,,,,150,,,150,150,150,150,,,,,150,150', -',150,,150,150,,,150,150,,,,,,150,150,150,150,150,150,,,,150,150,,,,', -',,,,,,,,,,,,,,,,,,,,,,,,150,150,,,,150,,150,150,148,150,,148,148,148', -'148,148,148,148,148,148,148,,,,,148,,,148,148,,,,,148,,,148,148,148', -'148,,,,,148,148,,148,,148,148,,,148,148,,,,,,148,148,148,148,148,148', -',,,148,148,,,,,,,,,,,,,,,,,,,,,,,,,,,,,148,148,,,,148,,148,148,147,148', -',147,147,147,147,147,147,147,147,147,147,,,,,147,,,147,147,,,,,147,', -',147,147,147,147,,,,,147,147,,147,,147,147,,,147,147,,,,,,147,147,147', -'147,147,147,,,,147,147,,,,,,,,,,,,,,,,,,,,,,,,,,,,,147,147,,,,147,,147', -'147,145,147,,145,145,145,145,145,145,145,145,145,145,,,,,145,,,145,145', -',,,,145,,,145,145,145,145,,,,,145,145,,145,,145,145,,,145,145,,,,,,145', -'145,145,145,145,145,,,,145,145,,,,,,,,,,,,,,,,,,,,,,,,,,,,,145,145,', -',,145,,145,145,101,145,,101,101,101,101,101,101,101,101,101,101,,,,', -'101,,,101,101,,,,,101,,,101,101,101,101,,,,,101,101,,101,,101,101,,', -'101,101,101,,,,,101,101,101,101,101,101,,,,101,101,,,,,,,,,,,,,,,,,', -',,,,,,,,,,,101,101,,,,101,,101,101,102,101,,102,102,102,102,102,102', -'102,102,102,102,,,,,102,,,102,102,,,,,102,,,102,102,102,102,,,,,102', -'102,,102,,102,102,,,102,102,,,,,,102,102,102,102,102,102,,,,102,102', -',,,,,,,,,,,,,,,,,,,,,,,,,,,,102,102,,,,102,,102,102,311,102,,311,311', -'311,311,311,311,311,311,311,311,,,,,311,,,311,311,,,,,311,,,311,311', -'311,311,,,,,311,311,,311,,311,311,,,311,311,,,,,,311,311,311,311,311', -'311,,,,311,311,,,,,,,,,,,,,,,,,,,,,,,,,,,,,311,311,,,,311,,311,311,143', -'311,,143,143,143,143,143,143,143,143,143,143,,,,,143,,,143,143,,,,,143', -',,143,143,143,143,,,,,143,143,,143,,143,143,,,143,143,,,,,,143,143,143', -'143,143,143,,,,143,143,,,,,,,,,,,,,,,,,,,,,,,,,,,,,143,143,,,,143,,143', -'143,142,143,,142,142,142,142,142,142,142,142,142,142,,,,,142,,,142,142', -',,,,142,,,142,142,142,142,,,,,142,142,,142,,142,142,,,142,142,,,,,,142', -'142,142,142,142,142,,,,142,142,,,,,,,,,,,,,,,,,,,,,,,,,,,,,142,142,', -',,142,,142,142,141,142,,141,141,141,141,141,141,141,141,141,141,,,,', -'141,,,141,141,,,,,141,,,141,141,141,141,,,,,141,141,,141,,141,141,,', -'141,141,,,,,,141,141,141,141,141,141,,,,141,141,,,,,,,,,,,,,,,,,,,,', -',,,,,,,,141,141,,,,141,,141,141,140,141,,140,140,140,140,140,140,140', -'140,140,140,,,,,140,,,140,140,,,,,140,,,140,140,140,140,,,,,140,140', -',140,,140,140,,,140,140,,,,,,140,140,140,140,140,140,,,,140,140,,,,', -',,,,,,,,,,,,,,,,,,,,,,,,140,140,,,,140,,140,140,112,140,,112,112,112', -'112,112,112,112,112,112,112,,,,,112,,,112,112,,,,,112,,,112,112,112', -'112,,,,,112,112,,112,,112,112,,,112,112,,,,,,112,112,112,112,112,112', -',,,112,112,,,,,,,,,,,,,,,,,,,,,,,,,,,,,112,112,,,,112,,112,112,139,112', -',139,139,139,139,139,139,139,139,139,139,,,,,139,,,139,139,,,,,139,', -',139,139,139,139,,,,,139,139,,139,,139,139,,,139,139,,,,,,139,139,139', -'139,139,139,,,,139,139,,,,,,,,,,,,,,,,,,,,,,,,,,,,,139,139,,,,139,,139', -'139,138,139,,138,138,138,138,138,138,138,138,138,138,,,,,138,,,138,138', -',,,,138,,,138,138,138,138,,,,,138,138,,138,,138,138,,,138,138,,,,,,138', -'138,138,138,138,138,,,,138,138,,,,,,,,,,,,,,,,,,,,,,,,,,,,,138,138,', -',,138,,138,138,115,138,,115,115,115,115,115,115,115,115,115,115,,,,', -'115,,,115,115,,,,,115,,,115,115,115,115,,,,,115,115,,115,,115,115,,', -'115,115,115,,,,,115,115,115,115,115,115,,,,115,115,,,,,,,,,,,,,,,,,', -',,,,,,,,,,,115,115,,,,115,,115,115,137,115,,137,137,137,137,137,137', -'137,137,137,137,,,,,137,,,137,137,,,,,137,,,137,137,137,137,,,,,137', -'137,,137,,137,137,,,137,137,,,,,,137,137,137,137,137,137,,,,137,137', -',,,,,,,,,,,,,,,,,,,,,,,,,,,,137,137,,,,137,,137,137,0,137,,0,0,0,0,0', -'0,0,0,0,0,,,,,0,,,0,0,,,,,0,,,0,0,0,0,,,,,0,0,,0,,0,0,,,0,0,0,,,,,0', -'0,0,0,0,0,,,,0,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,0,0,,0,,0,0,136,0,', -'136,136,136,136,136,136,136,136,136,136,,,,,136,,,136,136,,,,,136,,', -'136,136,136,136,,,,,136,136,,136,,136,136,,,136,136,,,,,,136,136,136', -'136,136,136,,,,136,136,,,,,,,,,,,,,,,,,,,,,,,,,,,,,136,136,,,,136,,136', -'136,135,136,,135,135,135,135,135,135,135,135,135,135,,,,,135,,,135,135', -',,,,135,,,135,135,135,135,,,,,135,135,,135,,135,135,,,135,135,,,,,,135', -'135,135,135,135,135,,,,135,135,,,,,,,,,,,,,,,,,,,,,,,,,,,,,135,135,', -',,135,,135,135,134,135,,134,134,134,134,134,134,134,134,134,134,,,,', -'134,,,134,134,,,,,134,,,134,134,134,134,,,,,134,134,,134,,134,134,,', -'134,134,,,,,,134,134,134,134,134,134,,,,134,134,,,,,,,,,,,,,,,,,,,,', -',,,,,,,,134,134,,,,134,,134,134,133,134,,133,133,133,133,133,133,133', -'133,133,133,,,,,133,,,133,133,,,,,133,,,133,133,133,133,,,,,133,133', -',133,,133,133,,,133,133,,,,,,133,133,133,133,133,133,,,,133,133,,,,', -',,,,,,,,,,,,,,,,,,,,,,,,133,133,,,,133,,133,133,123,133,,123,123,123', -'123,123,123,123,123,123,123,,,,,123,,,123,123,,,,,123,,,123,123,123', -'123,,,,,123,123,,123,,123,123,,,123,123,,,,,,123,123,123,123,123,123', -',,,123,123,,,,,,,,,,,,,,,,,,,,,,,,,,,,,123,123,,,,123,,123,123,132,123', -',132,132,132,132,132,132,132,132,132,132,,,,,132,,,132,132,,,,,132,', -',132,132,132,132,,,,,132,132,,132,,132,132,,,132,132,,,,,,132,132,132', -'132,132,132,,,,132,132,,,,,,,,,,,,,,,,,,,,,,,,,,,,,132,132,,,,132,,132', -'132,129,132,,129,129,129,129,129,129,129,129,129,129,,,,,129,,,129,129', -',,,,129,,,129,129,129,129,,,,,129,129,,129,,129,129,,,129,129,,,,,,129', -'129,129,129,129,129,,,,129,129,,,,,,,,,,,,,,,,,,,,,,,,,,,,,129,129,', -',,129,,129,129,127,129,,127,127,127,127,127,127,127,127,127,127,,,,', -'127,,,127,127,,,,,127,,,127,127,127,127,,,,,127,127,,127,,127,127,,', -'127,127,,,,,,127,127,127,127,127,127,,,,127,127,,,,,,,,,,,,,,,,,,,,', -',,,,,,,,127,127,,,,127,,127,127,212,127,,212,212,212,212,212,212,212', -'212,212,212,,,,,212,,,212,212,,,,,212,,,212,212,212,212,,,,,212,212', -',212,,212,212,,,212,212,314,,314,,,212,212,212,212,212,212,,,,212,212', -',,,,,,,,,,,,,,,,314,314,,,,314,,,,314,,,212,212,,,,212,314,212,212,', -'212,,,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314', +'232,232,232,232,232,232,,,,7,7,,,,7,,7,7,10,7,,10,10,10,10,10,10,10', +'10,10,10,,,,,10,,,10,10,,,,,10,,,10,10,10,10,,,,,10,10,,10,,10,10,,', +',10,10,,,,,10,10,10,10,10,10,,,,,,10,10,228,228,228,228,228,228,228', +'228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,228,,,,10', +'10,,,,10,,10,10,12,10,,12,12,12,12,12,12,12,12,12,12,,,,,12,,,12,12', +',,,,12,,,12,12,12,12,,,,,12,12,,12,,12,12,,,,12,12,,,,,12,12,12,12,12', +'12,,,,,,12,12,225,225,225,225,225,225,225,225,225,225,225,225,225,225', +'225,225,225,225,225,225,225,225,225,,,,12,12,,,,12,,12,12,13,12,,13', +'13,13,13,13,13,13,13,13,13,,,,,13,,,13,13,,,,,13,,,13,13,13,13,,,,,13', +'13,,13,,13,13,,,,13,13,,,,,13,13,13,13,13,13,,,,,,13,13,241,241,241', +'241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241,241', +'241,241,241,,,,13,13,,,,13,,13,13,16,13,,16,16,16,16,16,16,16,16,16', +'16,,,,,16,,,16,16,,,,,16,,,16,16,16,16,,,,,16,16,,16,,16,16,,,,16,16', +',,,,16,16,16,16,16,16,,,,,,16,16,238,238,238,238,238,238,238,238,238', +'238,238,238,238,238,238,238,238,238,238,238,238,238,238,,,,16,16,,,', +'16,,16,16,19,16,,19,19,19,19,19,19,19,19,19,19,,,,,19,,,19,19,,,,,19', +',,19,19,19,19,,,,,19,19,,19,,19,19,,,,19,19,,,,,19,19,19,19,19,19,,', +',,,19,19,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235', +'235,235,235,235,235,235,235,235,,,,19,19,,,,19,,19,19,287,19,,287,287', +'287,287,287,287,287,287,287,287,,,,,287,,,287,287,,,,,287,,,287,287', +'287,287,,,,,287,287,,287,,287,287,,,,287,287,,,,,287,287,287,287,287', +'287,,,,,,287,287,220,220,220,220,220,220,220,220,220,220,220,220,220', +'220,220,220,220,220,220,220,220,220,220,,,,287,287,,,,287,,287,287,22', +'287,,22,22,22,22,22,22,22,22,22,22,,,,,22,,,22,22,,,,,22,,,22,22,22', +'22,,,,,22,22,,22,,22,22,,,,22,22,,,,,22,22,22,22,22,22,,,,,,22,22,245', +'245,245,245,245,245,245,245,245,245,245,245,245,245,245,226,226,226', +'226,226,226,226,226,226,,,22,22,,,,22,,22,22,286,22,,286,286,286,286', +'286,286,286,286,286,286,,,,,286,,,286,286,,,,,286,,,286,286,286,286', +',,,,286,286,,286,,286,286,,,,286,286,,,,,286,286,286,286,286,286,,,', +',,286,286,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253', +'229,229,229,229,229,229,229,229,229,,,286,286,,,,286,,286,286,277,286', +',277,277,277,277,277,277,277,277,277,277,,,,,277,,,277,277,,,,,277,', +',277,277,277,277,,,,,277,277,,277,,277,277,,,,277,277,,,,,277,277,277', +'277,277,277,,,,,277,277,277,216,216,216,216,216,216,216,216,216,216', +'216,216,216,216,216,233,233,233,233,233,233,233,233,233,,,277,277,,', +',277,,277,277,275,277,,275,275,275,275,275,275,275,275,275,275,,,,,275', +',,275,275,,,,,275,,,275,275,275,275,,,,,275,275,,275,,275,275,,,,275', +'275,,,,,275,275,275,275,275,275,,,,,,275,275,242,242,242,242,242,242', +'242,242,242,239,239,239,239,239,239,239,239,239,217,217,217,217,217', +'217,217,,275,275,,,,275,,275,275,274,275,,274,274,274,274,274,274,274', +'274,274,274,,,,,274,,,274,274,,,,,274,,,274,274,274,274,,,,,274,274', +',274,,274,274,,,,274,274,,,,,274,274,274,274,274,274,,,,,,274,274,236', +'236,236,236,236,236,236,236,236,221,221,221,221,221,221,221,,,,,,,,', +',,274,274,,,,274,,274,274,33,274,,33,33,33,33,33,33,33,33,33,33,,,,', +'33,,,33,33,,,,,33,,,33,33,33,33,,,,,33,33,,33,,33,33,,,,33,33,,,,,33', +'33,33,33,33,33,,,,,,33,33,,,,,,,,,,,,,,,,,,,,,,,,,,,33,33,,,,33,,33', +'33,35,33,,35,35,35,35,35,35,35,35,35,35,,,,,35,,,35,35,,,,,35,,,35,35', +'35,35,,,,,35,35,,35,,35,35,,,,35,35,35,,,,35,35,35,35,35,35,,,,,,35', +'35,,,,,,,,,,,,,,,,,,,,,,,,,,,35,35,,,,35,,35,35,262,35,,262,262,262', +'262,262,262,262,262,262,262,,,,,262,,,262,262,,,,,262,,,262,262,262', +'262,,,,,262,262,,262,,262,262,,,,262,262,,,,,262,262,262,262,262,262', +',,,,,262,262,,,,,,,,,,,,,,,,,,,,,,,,,,,262,262,,,,262,,262,262,40,262', +',40,40,40,40,40,40,40,40,40,40,,,,,40,,,40,40,,,,,40,,,40,40,40,40,', +',,,40,40,,40,,40,40,,,,40,40,,,,,40,40,40,40,40,40,,,,,,40,40,,,,,,', +',,,,,,,,,,,,,,,,,,,,40,40,,,,40,,40,40,213,40,,213,213,213,213,213,213', +'213,213,213,213,,,,,213,,,213,213,,,,,213,,,213,213,213,213,,,,,213', +'213,,213,,213,213,,,,213,213,,,,,213,213,213,213,213,213,,,,,,213,213', +',,,,,,,,,,,,,,,,,,,,,,,,,,213,213,,,,213,,213,213,44,213,,44,44,44,44', +'44,44,44,44,44,44,,,,,44,,,44,44,,,,,44,,,44,44,44,44,,,,,44,44,,44', +',44,44,,,,44,44,,,,,44,44,44,44,44,44,,,,,,44,44,,,,,,,,,,,,,,,,,,,', +',,,,,,,44,44,,,,44,,44,44,47,44,,47,47,47,47,47,47,47,47,47,47,,,,,47', +',,47,47,,,,,47,,,47,47,47,47,,,,,47,47,,47,,47,47,,,,47,47,,,,,47,47', +'47,47,47,47,,,,,,47,47,,,,,,,,,,,,,,,,,,,,,,,,,,,47,47,,,,47,,47,47', +'52,47,,52,52,52,52,52,52,52,52,52,52,,,,,52,,,52,52,,,,,52,,,52,52,52', +'52,,,,,52,52,,52,,52,52,,,,52,52,,,,,52,52,52,52,52,52,,,,,,52,52,,', +',,,,,,,,,,,,,,,,,,,,,,,,52,52,,,,52,,52,52,212,52,,212,212,212,212,212', +'212,212,212,212,212,,,,,212,,,212,212,,,,,212,,,212,212,212,212,,,,', +'212,212,,212,,212,212,,,,212,212,,,,,212,212,212,212,212,212,,,,,,212', +'212,,,,,,,,,,,,,,,,,,,,,,,,,,,212,212,,,,212,,212,212,59,212,,59,59', +'59,59,59,59,59,59,59,59,,,,,59,,,59,59,,,,,59,,,59,59,59,59,,,,,59,59', +',59,,59,59,,,,59,59,,59,,,59,59,59,59,59,59,,,,,,59,59,,,,,,,,,,,,,', +',,,,,,,,,,,,,59,59,,,,59,,59,59,200,59,,200,200,200,200,200,200,200', +'200,200,200,,,,,200,,,200,200,,,,,200,,,200,200,200,200,,,,,200,200', +',200,,200,200,,,,200,200,200,,,,200,200,200,200,200,200,,,,,,200,200', +',,,,,,,,,,,,,,,,,,,,,,,,,,200,200,200,200,,200,,200,200,199,200,,199', +'199,199,199,199,199,199,199,199,199,,,,,199,,,199,199,,,,,199,,,199', +'199,199,199,,,,,199,199,,199,,199,199,,,,199,199,,,,,199,199,199,199', +'199,199,,,,,,199,199,,,,,,,,,,,,,,,,,,,,,,,,,,,199,199,,,,199,,199,199', +'186,199,,186,186,186,186,186,186,186,186,186,186,,,,,186,,,186,186,', +',,,186,,,186,186,186,186,,,,,186,186,,186,,186,186,,,,186,186,,,,,186', +'186,186,186,186,186,,,,,,186,186,,,,,,,,,,,,,,,,,,,,,,,,,,,186,186,', +',,186,,186,186,185,186,,185,185,185,185,185,185,185,185,185,185,,,,', +'185,,,185,185,,,,,185,,,185,185,185,185,,,,,185,185,,185,,185,185,,', +',185,185,,,,,185,185,185,185,185,185,,,,,,185,185,,,,,,,,,,,,,,,,,,', +',,,,,,,,185,185,,,,185,,185,185,171,185,,171,171,171,171,171,171,171', +'171,171,171,,,,,171,,,171,171,,,,,171,,,171,171,171,171,,,,,171,171', +',171,,171,171,,,,171,171,,,,,171,171,171,171,171,171,,,,,,171,171,,', +',,,,,,,,,,,,,,,,,,,,,,,,171,171,,,,171,,171,171,167,171,,167,167,167', +'167,167,167,167,167,167,167,,,,,167,,,167,167,,,,,167,,,167,167,167', +'167,,,,,167,167,,167,,167,167,,,,167,167,,,,,167,167,167,167,167,167', +',,,,,167,167,,,,,,,,,,,,,,,,,,,,,,,,,,,167,167,,,,167,,167,167,71,167', +',71,71,71,71,71,71,71,71,71,71,,,,,71,,,71,71,,,,,71,,,71,71,71,71,', +',,,71,71,,71,,71,71,,,,71,71,,,,,71,71,71,71,71,71,,,,,,71,71,,,,,,', +',,,,,,,,,,,,,,,,,,,,71,71,,,,71,,71,71,74,71,,74,74,74,74,74,74,74,74', +'74,74,,,,,74,,,74,74,,,,,74,,,74,74,74,74,,,,,74,74,,74,,74,74,,,,74', +'74,,,,,74,74,74,74,74,74,,,,,,74,74,,,,,,,,,,,,,,,,,,,,,,,,,,,74,74', +',,,74,,74,74,166,74,,166,166,166,166,166,166,166,166,166,166,,,,,166', +',,166,166,,,,,166,,,166,166,166,166,,,,,166,166,,166,,166,166,,,,166', +'166,,,,,166,166,166,166,166,166,,,,,,166,166,,,,,,,,,,,,,,,,,,,,,,,', +',,,166,166,,,,166,,166,166,165,166,,165,165,165,165,165,165,165,165', +'165,165,,,,,165,,,165,165,,,,,165,,,165,165,165,165,,,,,165,165,,165', +',165,165,,,,165,165,,,,,165,165,165,165,165,165,,,,,,165,165,,,,,,,', +',,,,,,,,,,,,,,,,,,,165,165,,,,165,,165,165,163,165,,163,163,163,163', +'163,163,163,163,163,163,,,,,163,,,163,163,,,,,163,,,163,163,163,163', +',,,,163,163,,163,,163,163,,,,163,163,,,,,163,163,163,163,163,163,,,', +',,163,163,,,,,,,,,,,,,,,,,,,,,,,,,,,163,163,,,,163,,163,163,161,163', +',161,161,161,161,161,161,161,161,161,161,,,,,161,,,161,161,,,,,161,', +',161,161,161,161,,,,,161,161,,161,,161,161,,,,161,161,,,,,161,161,161', +'161,161,161,,,,,,161,161,,,,,,,,,,,,,,,,,,,,,,,,,,,161,161,,,,161,,161', +'161,160,161,,160,160,160,160,160,160,160,160,160,160,,,,,160,,,160,160', +',,,,160,,,160,160,160,160,,,,,160,160,,160,,160,160,,,,160,160,,,,,160', +'160,160,160,160,160,,,,,,160,160,,,,,,,,,,,,,,,,,,,,,,,,,,,160,160,', +',,160,,160,160,159,160,,159,159,159,159,159,159,159,159,159,159,,,,', +'159,,,159,159,,,,,159,,,159,159,159,159,,,,,159,159,,159,,159,159,,', +',159,159,,,,,159,159,159,159,159,159,,,,,,159,159,,,,,,,,,,,,,,,,,,', +',,,,,,,,159,159,,,,159,,159,159,158,159,,158,158,158,158,158,158,158', +'158,158,158,,,,,158,,,158,158,,,,,158,,,158,158,158,158,,,,,158,158', +',158,,158,158,,,,158,158,,,,,158,158,158,158,158,158,,,,,,158,158,,', +',,,,,,,,,,,,,,,,,,,,,,,,158,158,,,,158,,158,158,157,158,,157,157,157', +'157,157,157,157,157,157,157,,,,,157,,,157,157,,,,,157,,,157,157,157', +'157,,,,,157,157,,157,,157,157,,,,157,157,,,,,157,157,157,157,157,157', +',,,,,157,157,,,,,,,,,,,,,,,,,,,,,,,,,,,157,157,,,,157,,157,157,156,157', +',156,156,156,156,156,156,156,156,156,156,,,,,156,,,156,156,,,,,156,', +',156,156,156,156,,,,,156,156,,156,,156,156,,,,156,156,,,,,156,156,156', +'156,156,156,,,,,,156,156,,,,,,,,,,,,,,,,,,,,,,,,,,,156,156,,,,156,,156', +'156,155,156,,155,155,155,155,155,155,155,155,155,155,,,,,155,,,155,155', +',,,,155,,,155,155,155,155,,,,,155,155,,155,,155,155,,,,155,155,,,,,155', +'155,155,155,155,155,,,,,,155,155,,,,,,,,,,,,,,,,,,,,,,,,,,,155,155,', +',,155,,155,155,154,155,,154,154,154,154,154,154,154,154,154,154,,,,', +'154,,,154,154,,,,,154,,,154,154,154,154,,,,,154,154,,154,,154,154,,', +',154,154,,,,,154,154,154,154,154,154,,,,,,154,154,,,,,,,,,,,,,,,,,,', +',,,,,,,,154,154,,,,154,,154,154,153,154,,153,153,153,153,153,153,153', +'153,153,153,,,,,153,,,153,153,,,,,153,,,153,153,153,153,,,,,153,153', +',153,,153,153,,,,153,153,,,,,153,153,153,153,153,153,,,,,,153,153,,', +',,,,,,,,,,,,,,,,,,,,,,,,153,153,,,,153,,153,153,152,153,,152,152,152', +'152,152,152,152,152,152,152,,,,,152,,,152,152,,,,,152,,,152,152,152', +'152,,,,,152,152,,152,,152,152,,,,152,152,,,,,152,152,152,152,152,152', +',,,,,152,152,,,,,,,,,,,,,,,,,,,,,,,,,,,152,152,,,,152,,152,152,151,152', +',151,151,151,151,151,151,151,151,151,151,,,,,151,,,151,151,,,,,151,', +',151,151,151,151,,,,,151,151,,151,,151,151,,,,151,151,,,,,151,151,151', +'151,151,151,,,,,,151,151,,,,,,,,,,,,,,,,,,,,,,,,,,,151,151,,,,151,,151', +'151,149,151,,149,149,149,149,149,149,149,149,149,149,,,,,149,,,149,149', +',,,,149,,,149,149,149,149,,,,,149,149,,149,,149,149,,,,149,149,,,,,149', +'149,149,149,149,149,,,,,,149,149,,,,,,,,,,,,,,,,,,,,,,,,,,,149,149,', +',,149,,149,149,148,149,,148,148,148,148,148,148,148,148,148,148,,,,', +'148,,,148,148,,,,,148,,,148,148,148,148,,,,,148,148,,148,,148,148,,', +',148,148,,,,,148,148,148,148,148,148,,,,,,148,148,,,,,,,,,,,,,,,,,,', +',,,,,,,,148,148,,,,148,,148,148,147,148,,147,147,147,147,147,147,147', +'147,147,147,,,,,147,,,147,147,,,,,147,,,147,147,147,147,,,,,147,147', +',147,,147,147,,,,147,147,,,,,147,147,147,147,147,147,,,,,,147,147,,', +',,,,,,,,,,,,,,,,,,,,,,,,147,147,,,,147,,147,147,145,147,,145,145,145', +'145,145,145,145,145,145,145,,,,,145,,,145,145,,,,,145,,,145,145,145', +'145,,,,,145,145,,145,,145,145,,,,145,145,,,,,145,145,145,145,145,145', +',,,,,145,145,,,,,,,,,,,,,,,,,,,,,,,,,,,145,145,,,,145,,145,145,144,145', +',144,144,144,144,144,144,144,144,144,144,,,,,144,,,144,144,,,,,144,', +',144,144,144,144,,,,,144,144,,144,,144,144,,,,144,144,,,,,144,144,144', +'144,144,144,,,,,,144,144,,,,,,,,,,,,,,,,,,,,,,,,,,,144,144,,,,144,,144', +'144,101,144,,101,101,101,101,101,101,101,101,101,101,,,,,101,,,101,101', +',,,,101,,,101,101,101,101,,,,,101,101,,101,,101,101,,,,101,101,101,', +',,101,101,101,101,101,101,,,,,,101,101,,,,,,,,,,,,,,,,,,,,,,,,,,,101', +'101,,,,101,,101,101,102,101,,102,102,102,102,102,102,102,102,102,102', +',,,,102,,,102,102,,,,,102,,,102,102,102,102,,,,,102,102,,102,,102,102', +',,,102,102,,,,,102,102,102,102,102,102,,,,,,102,102,,,,,,,,,,,,,,,,', +',,,,,,,,,,102,102,,,,102,,102,102,311,102,,311,311,311,311,311,311,311', +'311,311,311,,,,,311,,,311,311,,,,,311,,,311,311,311,311,,,,,311,311', +',311,,311,311,,,,311,311,,,,,311,311,311,311,311,311,,,,,,311,311,,', +',,,,,,,,,,,,,,,,,,,,,,,,311,311,,,,311,,311,311,142,311,,142,142,142', +'142,142,142,142,142,142,142,,,,,142,,,142,142,,,,,142,,,142,142,142', +'142,,,,,142,142,,142,,142,142,,,,142,142,,,,,142,142,142,142,142,142', +',,,,,142,142,,,,,,,,,,,,,,,,,,,,,,,,,,,142,142,,,,142,,142,142,141,142', +',141,141,141,141,141,141,141,141,141,141,,,,,141,,,141,141,,,,,141,', +',141,141,141,141,,,,,141,141,,141,,141,141,,,,141,141,,,,,141,141,141', +'141,141,141,,,,,,141,141,,,,,,,,,,,,,,,,,,,,,,,,,,,141,141,,,,141,,141', +'141,140,141,,140,140,140,140,140,140,140,140,140,140,,,,,140,,,140,140', +',,,,140,,,140,140,140,140,,,,,140,140,,140,,140,140,,,,140,140,,,,,140', +'140,140,140,140,140,,,,,,140,140,,,,,,,,,,,,,,,,,,,,,,,,,,,140,140,', +',,140,,140,140,139,140,,139,139,139,139,139,139,139,139,139,139,,,,', +'139,,,139,139,,,,,139,,,139,139,139,139,,,,,139,139,,139,,139,139,,', +',139,139,,,,,139,139,139,139,139,139,,,,,,139,139,,,,,,,,,,,,,,,,,,', +',,,,,,,,139,139,,,,139,,139,139,112,139,,112,112,112,112,112,112,112', +'112,112,112,,,,,112,,,112,112,,,,,112,,,112,112,112,112,,,,,112,112', +',112,,112,112,,,,112,112,,,,,112,112,112,112,112,112,,,,,,112,112,,', +',,,,,,,,,,,,,,,,,,,,,,,,112,112,,,,112,,112,112,138,112,,138,138,138', +'138,138,138,138,138,138,138,,,,,138,,,138,138,,,,,138,,,138,138,138', +'138,,,,,138,138,,138,,138,138,,,,138,138,,,,,138,138,138,138,138,138', +',,,,,138,138,,,,,,,,,,,,,,,,,,,,,,,,,,,138,138,,,,138,,138,138,114,138', +',114,114,114,114,114,114,114,114,114,114,,,,,114,,,114,114,,,,,114,', +',114,114,114,114,,,,,114,114,,114,,114,114,,,,114,114,114,,,,114,114', +'114,114,114,114,,,,,,114,114,,,,,,,,,,,,,,,,,,,,,,,,,,,114,114,,,,114', +',114,114,0,114,,0,0,0,0,0,0,0,0,0,0,,,,,0,,,0,0,,,,,0,,,0,0,0,0,,,,', +'0,0,,0,,0,0,,,,0,0,0,,,,0,0,0,0,0,0,,,,,,0,0,,,,,,,,,,,,,,,,,,,,,,,', +',,,0,0,0,0,,0,,0,0,137,0,,137,137,137,137,137,137,137,137,137,137,,', +',,137,,,137,137,,,,,137,,,137,137,137,137,,,,,137,137,,137,,137,137', +',,,137,137,,,,,137,137,137,137,137,137,,,,,,137,137,,,,,,,,,,,,,,,,', +',,,,,,,,,,137,137,,,,137,,137,137,136,137,,136,136,136,136,136,136,136', +'136,136,136,,,,,136,,,136,136,,,,,136,,,136,136,136,136,,,,,136,136', +',136,,136,136,,,,136,136,,,,,136,136,136,136,136,136,,,,,,136,136,,', +',,,,,,,,,,,,,,,,,,,,,,,,136,136,,,,136,,136,136,128,136,,128,128,128', +'128,128,128,128,128,128,128,,,,,128,,,128,128,,,,,128,,,128,128,128', +'128,,,,,128,128,,128,,128,128,,,,128,128,,,,,128,128,128,128,128,128', +',,,,,128,128,,,,,,,,,,,,,,,,,,,,,,,,,,,128,128,,,,128,,128,128,134,128', +',134,134,134,134,134,134,134,134,134,134,,,,,134,,,134,134,,,,,134,', +',134,134,134,134,,,,,134,134,,134,,134,134,,,,134,134,,,,,134,134,134', +'134,134,134,,,,,,134,134,,,,,,,,,,,,,,,,,,,,,,,,,,,134,134,,,,134,,134', +'134,133,134,,133,133,133,133,133,133,133,133,133,133,,,,,133,,,133,133', +',,,,133,,,133,133,133,133,,,,,133,133,,133,,133,133,,,,133,133,,,,,133', +'133,133,133,133,133,,,,,,133,133,,,,,,,,,,,,,,,,,,,,,,,,,,,133,133,', +',,133,,133,133,132,133,,132,132,132,132,132,132,132,132,132,132,,,,', +'132,,,132,132,,,,,132,,,132,132,132,132,,,,,132,132,,132,,132,132,,', +',132,132,,,,,132,132,132,132,132,132,,,,,,132,132,,,,,,,,,,,,,,,,,,', +',,,,,,,,132,132,,,,132,,132,132,123,132,,123,123,123,123,123,123,123', +'123,123,123,,,,,123,,,123,123,,,,,123,,,123,123,123,123,,,,,123,123', +',123,,123,123,,,,123,123,,,,,123,123,123,123,123,123,,,,,,123,123,,', +',,,,,,,,,,,,,,,,,,,,,,,,123,123,,,,123,,123,123,131,123,,131,131,131', +'131,131,131,131,131,131,131,,,,,131,,,131,131,,,,,131,,,131,131,131', +'131,,,,,131,131,,131,,131,131,,,,131,131,,,,,131,131,131,131,131,131', +',,,,,131,131,,,,,,,,,,,,,,,,,,,,,,,,,,,131,131,,,,131,,131,131,129,131', +',129,129,129,129,129,129,129,129,129,129,,,,,129,,,129,129,,,,,129,', +',129,129,129,129,,,,,129,129,,129,,129,129,,,,129,129,,,,,129,129,129', +'129,129,129,,,,,,129,129,,,,,,,,,,,,,,,,,,,,,,,,,,,129,129,,,,129,,129', +'129,127,129,,127,127,127,127,127,127,127,127,127,127,,,,,127,,,127,127', +',,,,127,,,127,127,127,127,,,,,127,127,,127,,127,127,,,,127,127,,,,,127', +'127,127,127,127,127,,,,,,127,127,,,,,,,,,,,,,,,,,,,,,,,,,,,127,127,', +',,127,,127,127,135,127,,135,135,135,135,135,135,135,135,135,135,,,,', +'135,,,135,135,,,,,135,,,135,135,135,135,,,,,135,135,,135,,135,135,,', +',135,135,314,,314,,135,135,135,135,135,135,,,,,,135,135,,,,,,,,,,,,', +',,,314,314,,,,314,,,,314,,135,135,,,,135,,135,135,,135,,,,314,314,314', '314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314', -'314,303,,303,,,,,,,,314,,,,,,,,,,,,,,,,,,,,,,303,303,,,,303,,,,303,', -',,,,,,,303,,,,,,,303,303,303,303,303,303,303,303,303,303,303,303,303', +'314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,303,,303', +',,,,,,314,,,,,,,,,,,,,,,,,,,,,,,303,303,,,,303,,,,303,,,,,,,,,,,,,,', +',303,303,303,303,303,303,303,303,303,303,303,303,303,303,303,303,303', '303,303,303,303,303,303,303,303,303,303,303,303,303,303,303,303,303', -'303,303,303,303,312,312,312,312,312,312,312,312,312,312,303,,,,312,', -',312,312,,,,,312,,,312,312,312,,,,,,,312,,312,,312,312,,,312,312,,,', -',,312,312,312,312,312,312,,,,312,312,,,,,158,158,158,158,158,158,158', -'158,158,158,,,,,158,,,158,158,,,,,158,312,312,158,158,158,312,,312,312', -',312,158,,158,,158,158,,,158,158,,,,,,158,158,158,158,170,170,170,170', -'170,170,170,170,170,170,,,,,,,,,,,,,,,,,,170,170,,,,,,,158,158,,,,158', -',158,158,170,158,,,,,,,,,,,,,,,,,,25,25,25,25,25,25,25,25,25,25,,,,', -'25,,,25,25,,,,,25,,,25,25,25,25,,170,,170,170,25,170,25,,25,25,,,25', -'25,,,,,,25,25,25,25,25,25,,,,25,25,,,,,302,302,302,302,302,302,302,302', -'302,302,,,,,302,,,302,302,,,,,302,25,25,302,302,302,25,,25,25,,25,302', -',302,,302,302,,,302,302,266,,266,,,302,302,302,302,302,302,,,,302,302', -',,,,,,,,,,,,,,,,266,266,,,,266,,,,266,,,302,302,,,,302,266,302,302,', -'302,,,266,266,266,266,266,266,266,266,266,266,266,266,266,266,266,266', -'266,266,266,266,266,266,266,266,266,266,266,266,266,266,266,266,266', -'266,297,,297,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,297,297,,,,297,,,,297,,,,', -',,,,297,,,,,,,297,297,297,297,297,297,297,297,297,297,297,297,297,297', -'297,297,297,297,297,297,297,297,297,297,297,297,297,297,297,297,297', -'297,297,297,300,,300,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,300,300,,,,300,,,', -'300,,,,,,,,,300,,,,,,,300,300,300,300,300,300,300,300,300,300,300,300', -'300,300,300,300,300,300,300,300,300,300,300,300,300,300,300,300,300', -'300,300,300,300,300,301,,301,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,301,301,,', -',301,,,,301,,,,,,,,,301,,,,,,,301,301,301,301,301,301,301,301,301,301', -'301,301,301,301,301,301,301,301,301,301,301,301,301,301,301,301,301', -'301,301,301,301,301,301,301,276,,276,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,276', -'276,,,,276,,,,276,,,,,,,,,276,,,,,,,276,276,276,276,276,276,276,276', -'276,276,276,276,276,276,276,276,276,276,276,276,276,276,276,276,276', -'276,276,276,276,276,276,276,276,276,273,,273,,,,,,,,,,,,,,,,,,,,,,,', -',,,,,,273,273,,,,273,,,,273,,,,,,,,,273,,,,,,,273,273,273,273,273,273', +'303,,,,,,,,,,303,162,162,162,162,162,162,162,162,162,162,,,,,162,,,162', +'162,,,,,162,,,162,162,162,,,,,,,162,,162,,162,162,,,,162,162,,,,,162', +'162,162,162,162,162,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,162,162,,,,162', +',162,162,,162,25,25,25,25,25,25,25,25,25,25,,,,,25,,,25,25,,,,,25,,', +'25,25,25,25,,,,,,25,,25,,25,25,,,,25,25,,,,,25,25,25,25,25,25,,,,,,25', +'25,,21,21,21,21,21,21,21,21,21,21,,,,,,,,,,,,,,,,25,25,21,21,,25,,25', +'25,,25,,,,,,,,,,21,,,,,,,,,,,,,,,,,,302,302,302,302,302,302,302,302', +'302,302,,,,,302,,,302,302,,,,,302,,,302,302,302,,,21,,21,21,302,21,302', +',302,302,,,,302,302,,,,,302,302,302,302,302,302,,,,,,,,,,312,312,312', +'312,312,312,312,312,312,312,,,,,312,,,312,312,,,,,312,302,302,312,312', +'312,302,,302,302,,302,312,,312,,312,312,,,,312,312,273,,273,,312,312', +'312,312,312,312,,,,,,,,,,,,,,,,,,,,,,,273,273,,,,273,,,,273,,312,312', +',,,312,,312,312,,312,,,,273,273,273,273,273,273,273,273,273,273,273', '273,273,273,273,273,273,273,273,273,273,273,273,273,273,273,273,273', -'273,273,273,273,273,273,273,273,273,273,273,114,,114,,,,,,,,,,,,,,,', -',,,,,,,,,,,,,,114,114,,,,114,,,,114,,,,,,,,,114,,,,,,,114,114,114,114', -'114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114', -'114,114,114,114,114,114,114,114,114,114,114,114,114,264,,264,,,,,,,', -',,,,,,,,,,,,,,,,,,,,,,264,264,,,,264,,,,264,,,,,,,,,264,,,,,,,264,264', -'264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,264', -'264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,236,,236', -',,,,,,,,,,,,,,,,,,,,,,,,,,,,,236,236,,,,236,,,,236,,,,,,,,,236,,,,,', -',236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236', -'236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236', -'230,,230,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,230,230,,,,230,,,,230,,,,,,,,', -'230,,,,,,,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230', -'230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230', -'230,230,222,,222,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,222,222,,,,222,,,,222', -',,,,,,,,222,,,,,,,222,222,222,222,222,222,222,222,222,222,222,222,222', -'222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222', -'222,222,222,222,210,,210,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,210,210,,,,210', -',,,210,,,,,,,,,210,,,,,,,210,210,210,210,210,210,210,210,210,210,210', -'210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210', -'210,210,210,210,210,210,197,,197,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,197,197', -',,,197,,,,197,,,,,,,,,197,,,,,,,197,197,197,197,197,197,197,197,197', -'197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197', -'197,197,197,197,197,197,197,197,193,,193,,,,,,,,,,,,,,,,,,,,,,,193,', -',,,,,193,193,,,,193,,,,193,,,,,,,,,193,,,,,,,193,193,193,193,193,193', -'193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193', -'193,193,193,193,193,193,193,193,193,193,193,192,,192,,,,,,,,,,,,,,,', -',,,,,,,,,,,,,,192,192,,,,192,,,,192,,,,,,,,,192,,,,,,,192,192,192,192', +'273,273,273,273,273,273,273,113,,113,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,113', +'113,,,,113,,,,113,,,,,,,,,,,,,,,,113,113,113,113,113,113,113,113,113', +'113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113', +'113,113,113,113,113,113,113,113,113,301,,301,,,,,,,,,,,,,,,,,,,,,,,', +',,,,,,301,301,,,,301,,,,301,,,,,,,,,,,,,,,,301,301,301,301,301,301,301', +'301,301,301,301,301,301,301,301,301,301,301,301,301,301,301,301,301', +'301,301,301,301,301,301,301,301,301,301,301,300,,300,,,,,,,,,,,,,,,', +',,,,,,,,,,,,,,300,300,,,,300,,,,300,,,,,,,,,,,,,,,,300,300,300,300,300', +'300,300,300,300,300,300,300,300,300,300,300,300,300,300,300,300,300', +'300,300,300,300,300,300,300,300,300,300,300,300,300,297,,297,,,,,,,', +',,,,,,,,,,,,,,,,,,,,,,297,297,,,,297,,,,297,,,,,,,,,,,,,,,,297,297,297', +'297,297,297,297,297,297,297,297,297,297,297,297,297,297,297,297,297', +'297,297,297,297,297,297,297,297,297,297,297,297,297,297,297,192,,192', +',,,,,,,,,,,,,,,,,,,,,,,,,,,,,192,192,,,,192,,,,192,,,,,,,,,,,,,,,,192', '192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192', -'192,192,192,192,192,192,192,192,192,192,192,192,192,313,,313,,,,,,,', -',,,,,,,,,,,,,,,313,,,,,,,313,313,,,,313,,,,313,,,,,,,,,313,,,,,,,313', +'192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192', +'313,,313,,,,,,,,,,,,,,,,,,,,,,,313,,,,,,,313,313,,,,313,,,,313,,,,,', +',,,,,,,,,,313,313,313,313,313,313,313,313,313,313,313,313,313,313,313', '313,313,313,313,313,313,313,313,313,313,313,313,313,313,313,313,313', -'313,313,313,313,313,313,313,313,313,313,313,313,313,313,313,313,68,', -'68,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,68,68,,,,68,,,,68,,,,,,,,,68,,,,,,,68', -'68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68', -'68,68,68,68,68,68,68,68,68,68,87,,87,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,87', -'87,,,,87,,,,87,,,,,,,87,,87,,,,,,,87,87,87,87,87,87,87,87,87,87,87,87', -'87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,319', -',319,,,,,,,,,,,,,,,,,,,,,,,319,,,,,,,319,319,,,,319,,,,319,,,,,,,,,319', -',,,,,,319,319,319,319,319,319,319,319,319,319,319,319,319,319,319,319', -'319,319,319,319,319,319,319,319,319,319,319,319,319,319,319,319,319', -'319,86,,86,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,86,86,,,,86,,,,86,,,,,,,86,', -'86,,,,,,,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86', -'86,86,86,86,86,86,86,86,86,86,86,86,86,86,318,,318,,,,,,,,,,,,,,,,,', -',,,,,,,,,,,,318,318,,,,318,,,,318,,,,,,,,,318,,,,,,,318,318,318,318', +'313,313,313,318,,318,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,318,318,,,,318,,,', +'318,,,,,,,,,,,,,,,,318,318,318,318,318,318,318,318,318,318,318,318,318', '318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,318', -'318,318,318,318,318,318,318,318,318,318,318,318,318,84,,84,,,,,,,,,', -',,,,,,,,,,,,,,,,,,,,84,84,,,,84,,,,84,,,,,,,84,,84,,,,,,,84,84,84,84', -'84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84', -'84,84,84,84,84,84,84,93,93,,,,,,,,93,,,,,,,,,93,,,,,,,93,93,93,93,93', -'93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93', -'93,93,93,93,93,93,256,256,,,,,,,,256,,,,,,,,,256,,,,,,,256,256,256,256', +'318,318,318,318,318,193,,193,,,,,,,,,,,,,,,,,,,,,,,193,,,,,,,193,193', +',,,193,,,,193,,,,,,,,,,,,,,,,193,193,193,193,193,193,193,193,193,193', +'193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193,193', +'193,193,193,193,193,193,193,193,276,,276,,,,,,,,,,,,,,,,,,,,,,,,,,,', +',,276,276,,,,276,,,,276,,,,,,,,,,,,,,,,276,276,276,276,276,276,276,276', +'276,276,276,276,276,276,276,276,276,276,276,276,276,276,276,276,276', +'276,276,276,276,276,276,276,276,276,276,201,,201,,,,,,,,,,,,,,,,,,,', +',,,,,,,,,,201,201,,,,201,,,,201,,,,,,,,,,,,,,,,201,201,201,201,201,201', +'201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201', +'201,201,201,201,201,201,201,201,201,201,201,201,210,,210,,,,,,,,,,,', +',,,,,,,,,,,,,,,,,,210,210,,,,210,,,,210,,,,,,,,,,,,,,,,210,210,210,210', +'210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210', +'210,210,210,210,210,210,210,210,210,210,210,210,210,210,265,,265,,,', +',,,,,,,,,,,,,,,,,,,,,,,,,,265,265,,,,265,,,,265,,,,,,,,,,,,,,,,265,265', +'265,265,265,265,265,265,265,265,265,265,265,265,265,265,265,265,265', +'265,265,265,265,265,265,265,265,265,265,265,265,265,265,265,265,264', +',264,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,264,264,,,,264,,,,264,,,,,,,,,,,,', +',,,264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,264', +'264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,264', +'264,222,,222,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,222,222,,,,222,,,,222,,,,', +',,,,,,,,,,,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222', +'222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222', +'222,222,222,237,,237,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,237,237,,,,237,,,', +'237,,,,,,,,,,,,,,,,237,237,237,237,237,237,237,237,237,237,237,237,237', +'237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237', +'237,237,237,237,237,319,,319,,,,,,,,,,,,,,,,,,,,,,,319,,,,,,,319,319', +',,,319,,,,319,,,,,,,,,,,,,,,,319,319,319,319,319,319,319,319,319,319', +'319,319,319,319,319,319,319,319,319,319,319,319,319,319,319,319,319', +'319,319,319,319,319,319,319,319,86,,86,,,,,,,,,,,,,,,,,,,,,,,,,,,,,', +'86,86,,,,86,,,,86,,,,,,,,86,,,,,,,,86,86,86,86,86,86,86,86,86,86,86', +'86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86', +'86,230,,230,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,230,230,,,,230,,,,230,,,,,', +',,,,,,,,,,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230', +'230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230', +'230,230,230,84,,84,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,84,84,,,,84,,,,84,,', +',,,,,84,,,,,,,,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84', +'84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,68,,68,,,,,,,,,,', +',,,,,,,,,,,,,,,,,,,68,68,,,,68,,,,68,,,,,,,,,,,,,,,,68,68,68,68,68,68', +'68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68', +'68,68,68,68,68,68,87,,87,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,87,87,,,,87,,', +',87,,,,,,,,87,,,,,,,,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87', +'87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,256,256,,,', +',,,,256,,,,,,,,,,,,,,,,256,256,256,256,256,256,256,256,256,256,256,256', '256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256', -'256,256,256,256,256,256,256,256,256,256,256,256,256,227,227,,,,,,,,227', -',,,,,,,,227,,,,,,,227,227,227,227,227,227,227,227,227,227,227,227,227', -'227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227', -'227,231,231,,,,,,,,231,,,,,,,,,231,,,,,,,231,231,231,231,231,231,231', -'231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231', -'231,231,231,231,231,231,231,224,224,,,,,,,,224,,,,,,,,,224,,,,,,,224', -'224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224', -'224,224,224,224,224,224,224,224,224,224,224,224,224,119,119,,,,,,,,119', -',,,,,,,,119,,,,,,,119,119,119,119,119,119,119,119,119,119,119,119,119', +'256,256,256,256,256,256,93,93,,,,,,,,93,,,,,,,,,,,,,,,,93,93,93,93,93', +'93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93', +'93,93,93,93,93,93,93,119,119,,,,,,,,119,,,,,,,,,,,,,,,,119,119,119,119', '119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119', -'119,306,,,,,,,,306,,,,,,,,,306,,,,,,,306,306,306,306,306,306,306,306', -'306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306', -'306,306,306,306,306,306,307,,,,,,,,307,,,,,,,,,307,,,,,,,307,307,307', -'307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307', -'307,307,307,307,307,307,307,307,307,307,307,284,,,,,,,,284,,,,,,,,,284', -',,,,,,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284', -'284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,223,,,,', -',,,223,,,,,,,,,223,,,,,,,223,223,223,223,223,223,223,223,223,223,223', -'223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223', -'223,223,223,283,,,,,,,,283,,,,,,,,,283,,,,,,,283,283,283,283,283,283', +'119,119,119,119,119,119,119,119,119,119,119,119,119,119,283,,,,,,,,283', +',,,,,,,,,,,,,,,283,283,283,283,283,283,283,283,283,283,283,283,283,283', '283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283,283', -'283,283,283,283,283,283,283,283,110,,,,,,,,,110,,,,,,,110,110,110,110', +'283,283,283,283,284,,,,,,,,284,,,,,,,,,,,,,,,,284,284,284,284,284,284', +'284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284', +'284,284,284,284,284,284,284,284,284,284,284,284,306,,,,,,,,306,,,,,', +',,,,,,,,,,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306', +'306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306', +'306,306,306,307,,,,,,,,307,,,,,,,,,,,,,,,,307,307,307,307,307,307,307', +'307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307', +'307,307,307,307,307,307,307,307,307,307,307,223,,,,,,,,223,,,,,,,,,', +',,,,,,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223', +'223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223', +'223,223,110,,,,,,,,,,,,,,,,110,110,110,110,110,110,110,110,110,110,110', '110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110', -'110,110,110,110,110,110,110,110,110,92,,,,,,,,,92,,,,,,,92,92,92,92', +'110,110,110,110,110,110,110,92,,,,,,,,,,,,,,,,92,92,92,92,92,92,92,92', '92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92', -'92,92,92,250,,,,,,,,,250,,,,,,,250,250,250,250,250,250,250,250,250,250', -'250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250', -'250,250,250,251,,,,,,,251,251,251,251,251,251,251,251,251,251,251,251', +'92,92,92,92,251,,,,,,,,,,,,,,,,251,251,251,251,251,251,251,251,251,251', '251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251', -'251,240,,,,,,,240,240,240,240,240,240,240,240,240,240,240,240,240,240', -'240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,243', -',,,,,,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243', -'243,243,243,243,243,243,243,243,243,243,243,243,243,243,215,,,,,,,215', -'215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215', -'215,215,215,215,215,215,215,215,215,215,215,215,247,,,,,,,247,247,247', +'251,251,251,251,251,251,251,251,252,252,252,252,252,252,252,252,252', +'252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252', +'252,252,252,252,252,252,252,252,252,234,234,234,234,234,234,234,234', +'234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234', +'234,234,234,234,234,234,234,234,234,234,247,247,247,247,247,247,247', '247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,247', -'247,247,247,247,247,247,247,247,247,247' ] - racc_action_check = arr = Array.new(10938, nil) +'247,247,247,247,247,247,247,247,247,247,247,224,224,224,224,224,224', +'224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224', +'224,224,224,224,224,224,224,224,224,224,224,224,231,231,231,231,231', +'231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231', +'231,231,231,231,231,231,231,231,231,231,231,231,231,215,215,215,215', +'215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215', +'215,215,215,215,215,215,215,215,215,215,215,215,215,215,219,219,219', +'219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,219', +'219,219,219,219,219,219,219,219,219,219,219,219,219,219,219,227,227', +'227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227', +'227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,227' ] + racc_action_check = arr = Array.new(10987, nil) idx = 0 clist.each do |str| str.split(',', -1).each do |i| @@ -766,156 +772,156 @@ clist = [ end racc_action_pointer = [ - 6563, 288, 184, nil, nil, 301, nil, 402, nil, nil, + 6361, 294, 195, nil, nil, 301, nil, 402, nil, nil, 503, nil, 604, 705, nil, nil, 806, nil, nil, 907, - nil, -2, 1109, nil, nil, 7881, 136, nil, nil, nil, - 3, nil, 291, 1614, 1715, nil, 1816, -7, nil, 2018, - nil, nil, 2119, 129, nil, nil, nil, nil, nil, nil, - nil, nil, nil, 2321, 185, 2523, nil, nil, nil, nil, - nil, nil, 81, nil, nil, nil, 204, -54, 9450, 191, - -2, 3230, nil, nil, 3331, 264, nil, nil, 115, nil, - nil, 203, -5, 238, 9905, 393, 9723, 9541, 295, 177, - 476, 402, 10618, 9964, 56, 139, nil, 21, nil, 457, - nil, 5351, 5452, -13, 20, 37, nil, nil, nil, nil, - 10572, 480, 6058, 64, 8540, 6361, 396, -2, 107, 10250, - 235, nil, 78, 7068, 195, 227, nil, 7371, 2422, 7270, - 286, 207, 7169, 6967, 6866, 6765, 6664, 6462, 6260, 6159, - 5957, 5856, 5755, 5654, 99, 5250, nil, 5149, 5048, nil, - 4947, 4846, 4745, 4644, 4543, 4442, 4341, 4240, 7764, 4139, - 4038, 3937, 3836, 3735, 3634, 3533, 3432, 3129, nil, nil, - 7818, 3028, nil, 292, 468, nil, nil, nil, nil, 149, - 204, 152, nil, nil, 75, 2927, 84, 2826, nil, 177, - 120, -2, 9268, 9177, nil, nil, nil, 9086, nil, nil, - 2725, 2624, 126, 73, nil, 169, 183, 142, nil, nil, - 8995, 176, 7472, 2220, -12, 10812, 209, 1438, 84, 83, - 815, 1640, 8904, 10470, 10194, 916, 1539, 10082, 310, 1522, - 8813, 10138, 613, 1623, 714, 1421, 8722, 411, 1118, -24, - 10738, 1320, 278, 10775, nil, 1017, 379, 10849, 1219, -7, - 10664, 10701, 512, 191, 301, 375, 10023, -41, nil, -10, - 124, 125, 1917, nil, 8631, nil, 7994, nil, nil, 182, - nil, -68, nil, 8449, 1513, 1412, 8358, 1311, nil, 75, - 96, nil, nil, 10525, 10415, nil, 1210, 1008, 114, nil, - nil, nil, -2, 145, nil, nil, 42, 8085, nil, 200, - 8176, 8267, 7946, 7611, nil, nil, 10305, 10360, nil, 215, - 130, 5553, 7699, 9359, 7520, nil, nil, nil, 9814, 9632, + nil, 7876, 1109, nil, nil, 7812, 169, nil, nil, nil, + 301, nil, 15, 1614, nil, 1715, -10, nil, nil, nil, + 1917, 86, nil, nil, 2119, nil, nil, 2220, nil, nil, + nil, nil, 2321, 140, nil, nil, nil, nil, nil, 2523, + nil, nil, 74, nil, nil, nil, 237, 141, 9893, 213, + 237, 3230, nil, nil, 3331, 245, nil, nil, 94, nil, + nil, -10, -6, 187, 9801, 233, 9617, 9985, 76, 176, + 338, 402, 10562, 10105, 3, nil, 82, 175, nil, 80, + nil, 5351, 5452, 139, 190, 207, nil, nil, nil, nil, + 10511, -51, 6058, 8145, 6260, -2, 121, 108, 125, 10165, + 300, 65, nil, 7068, 221, 286, nil, 7371, 6664, 7270, + 312, 7169, 6967, 6866, 6765, 7472, 6563, 6462, 6159, 5957, + 5856, 5755, 5654, 99, 5250, 5149, nil, 5048, 4947, 4846, + nil, 4745, 4644, 4543, 4442, 4341, 4240, 4139, 4038, 3937, + 3836, 3735, 7712, 3634, 114, 3533, 3432, 3129, nil, nil, + -2, 3028, nil, 136, 170, nil, nil, nil, nil, 240, + 308, 196, nil, nil, -14, 2927, 2826, 76, nil, 176, + 120, -3, 8513, 8789, nil, nil, nil, nil, nil, 2725, + 2624, 8973, 178, 90, nil, 211, 213, 148, nil, nil, + 9065, 150, 2422, 2018, -13, 10823, 1320, 1439, 18, 10858, + 1017, 1531, 9341, 10460, 10753, 613, 1133, 10893, 512, 1234, + 9709, 10788, 411, 1335, 10683, 916, 1522, 9433, 815, 1430, + 64, 714, 1421, -16, 310, 1118, -20, 10718, 87, 209, + -29, 10613, 10648, 1219, 2, 272, 10045, -42, nil, -35, + 189, 111, 1816, nil, 9249, 9157, nil, nil, nil, 7, + nil, nil, -45, 8053, 1513, 1412, 8881, 1311, nil, 65, + 74, nil, nil, 10224, 10283, nil, 1210, 1008, 82, nil, + nil, nil, -7, 146, nil, nil, 0, 8421, nil, 200, + 8329, 8237, 7939, 7613, nil, nil, 10342, 10401, nil, 210, + 95, 5553, 8004, 8605, 7521, nil, nil, nil, 8697, 9525, nil, nil, nil ] racc_action_default = [ -1, -178, -185, -97, -10, -185, -105, -185, -26, -11, -185, -106, -185, -185, -27, -12, -185, -107, -13, -185, -108, -185, -185, -14, -109, -45, -119, -15, -28, -16, - -125, -29, -133, -185, -185, -31, -140, -185, -17, -185, - -34, -18, -185, -185, -35, -19, -36, -46, -20, -127, - -30, -21, -37, -185, -185, -185, -22, -38, -32, -2, + -125, -29, -133, -185, -31, -140, -185, -17, -34, -18, + -185, -185, -35, -19, -185, -36, -20, -185, -127, -46, + -21, -37, -185, -185, -30, -22, -38, -32, -2, -185, -23, -39, -3, -104, -103, -33, -185, -185, -5, -185, -8, -185, -96, -9, -185, -178, -180, -182, -185, -176, -98, -100, -185, -48, -157, -52, -185, -185, -54, -53, - -185, -126, -55, -44, -185, -119, -43, -185, -120, -185, + -185, -126, -55, -44, -185, -43, -185, -119, -120, -185, -130, -140, -185, -185, -185, -185, -111, -115, -116, -134, - -56, -50, -185, -185, -141, -140, -49, -185, -185, -154, - -185, -25, -185, -7, -161, -185, -4, -185, -185, -185, + -56, -185, -185, -141, -140, -185, -185, -50, -49, -154, + -185, -185, -25, -7, -161, -185, -4, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, - -185, -185, -185, -185, -185, -185, -58, -185, -185, -57, - -185, -185, -185, -185, -185, -185, -185, -185, -93, -185, - -185, -185, -185, -185, -185, -185, -185, -185, -95, -129, + -185, -185, -185, -185, -185, -185, -58, -185, -185, -185, + -57, -185, -185, -185, -185, -185, -185, -185, -185, -185, + -185, -185, -93, -185, -185, -185, -185, -185, -95, -129, -185, -185, -110, -51, -47, -181, -177, -179, -175, -185, -185, -185, -156, -174, -185, -185, -185, -185, -118, -185, - -185, -185, -141, -185, -112, -113, -114, -142, -139, -147, - -185, -185, -185, -185, -155, -150, -185, -185, 323, -24, - -6, -185, -185, -185, -185, -87, -75, -64, -185, -185, - -76, -65, -183, -92, -88, -77, -66, -89, -78, -67, - -184, -90, -79, -68, -80, -69, -158, -81, -70, -59, - -83, -71, -60, -84, -82, -72, -61, -85, -73, -62, - -91, -86, -74, -63, -128, -185, -40, -185, -99, -185, - -185, -185, -185, -169, -41, -124, -42, -122, -121, -185, - -131, -185, -117, -144, -185, -185, -143, -185, -132, -185, + -185, -185, -141, -185, -112, -113, -114, -139, -147, -185, + -185, -142, -185, -185, -155, -150, -185, -185, 323, -24, + -6, -185, -185, -185, -185, -85, -73, -62, -185, -86, + -74, -63, -183, -92, -87, -75, -64, -88, -76, -65, + -184, -89, -77, -66, -90, -78, -67, -158, -79, -68, + -59, -80, -69, -60, -81, -70, -61, -83, -82, -71, + -185, -91, -84, -72, -128, -185, -40, -185, -99, -185, + -185, -185, -185, -169, -41, -42, -124, -122, -121, -185, + -131, -117, -185, -144, -185, -185, -143, -185, -132, -185, -185, -151, -162, -163, -164, -160, -185, -185, -159, -102, - -101, -94, -185, -185, -167, -170, -185, -148, -123, -185, - -146, -145, -102, -185, -152, -153, -166, -165, -173, -185, + -101, -94, -185, -185, -170, -167, -185, -148, -123, -185, + -145, -146, -102, -185, -152, -153, -166, -165, -173, -185, -171, -185, -102, -185, -185, -135, -168, -172, -149, -185, -137, -136, -138 ] racc_goto_table = [ - 59, 80, 67, 214, 263, 267, 268, 83, 172, 84, - 169, 125, 85, 113, 86, 87, 76, 79, 88, 62, - 96, 89, 90, 91, 92, 99, 54, 93, 172, 296, - 169, 261, 205, 178, 259, 110, 111, 75, 114, 82, - 77, 116, nil, nil, 117, 118, nil, nil, nil, nil, - nil, nil, nil, nil, nil, 119, nil, nil, nil, nil, + 58, 172, 80, 67, 90, 263, 125, 169, 83, 95, + 84, 267, 268, 85, 214, 86, 87, 111, 76, 88, + 79, 172, 89, 53, 99, 92, 91, 169, 93, 62, + 296, 261, 205, 178, 259, 75, 110, 82, 113, 77, + nil, nil, nil, 115, 116, nil, nil, 117, nil, nil, + 118, nil, nil, nil, nil, 119, nil, nil, nil, nil, nil, nil, 123, nil, nil, nil, nil, 126, nil, nil, - nil, 168, nil, 173, 122, 218, 174, nil, 191, nil, - 177, 295, nil, nil, nil, 298, 182, nil, 183, 96, - 175, 176, 203, nil, 186, nil, 288, nil, nil, 189, - nil, nil, nil, 192, 193, nil, nil, nil, nil, nil, - nil, nil, 308, nil, 197, nil, nil, 192, nil, nil, - nil, nil, 123, nil, nil, 210, nil, nil, nil, 215, - 216, 217, nil, nil, 220, 221, 222, 223, 224, 225, - 226, 227, 228, 229, 230, 231, 232, 233, nil, 234, - 235, nil, 236, 237, 238, 239, 240, 241, 242, 243, - 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - nil, 254, 255, 256, nil, nil, nil, nil, 260, 258, - nil, nil, nil, 96, 96, nil, 189, 264, nil, 266, - 269, nil, 172, nil, 169, nil, nil, nil, nil, nil, - nil, 275, 273, 276, nil, nil, nil, nil, nil, 281, - nil, nil, nil, nil, 283, 284, 285, nil, nil, nil, + 218, nil, 168, nil, 173, nil, nil, 174, nil, nil, + 95, 177, 294, 191, nil, nil, nil, 182, 121, 183, + nil, 298, 175, nil, 176, 187, 203, nil, nil, 189, + nil, nil, nil, nil, 192, 193, nil, 288, nil, nil, + nil, nil, nil, 308, nil, 201, nil, 192, nil, nil, + nil, 123, nil, nil, nil, nil, 210, nil, nil, nil, + 215, 216, 217, nil, 219, 220, 221, 222, 223, 224, + 225, 226, 227, 228, 229, 230, 231, 232, 233, nil, + 234, 235, 236, 254, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 247, 248, 249, 260, 251, 252, + 253, nil, 95, 95, 256, 255, nil, nil, nil, nil, + 258, nil, nil, nil, nil, 172, nil, 189, 264, 265, + 269, 169, nil, nil, nil, nil, nil, nil, nil, nil, + 274, nil, 273, 276, nil, nil, nil, nil, nil, nil, + 281, nil, nil, nil, nil, 283, 284, 285, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, 260, nil, nil, nil, nil, - 292, 291, nil, 96, 297, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 300, 301, nil, 303, - nil, 304, 305, nil, nil, nil, 260, nil, 306, 307, - nil, nil, nil, nil, nil, 309, nil, nil, 310, nil, - nil, 313, nil, nil, 314, nil, nil, nil, nil, nil, - 317, nil, nil, 318, 319 ] + nil, nil, nil, nil, 260, nil, nil, nil, nil, nil, + nil, nil, 95, nil, nil, nil, nil, nil, nil, nil, + 292, nil, 291, nil, nil, 297, nil, nil, nil, nil, + nil, nil, nil, nil, nil, 260, nil, 300, 301, nil, + 303, nil, 304, 305, nil, nil, nil, nil, nil, 306, + 307, nil, nil, nil, nil, nil, 309, nil, nil, 310, + nil, nil, 313, nil, nil, 314, nil, nil, nil, nil, + 317, nil, nil, nil, 318, 319 ] racc_goto_check = [ - 2, 26, 4, 43, 45, 23, 23, 5, 32, 5, - 38, 42, 5, 39, 5, 5, 49, 47, 5, 3, - 21, 5, 6, 33, 5, 36, 1, 5, 32, 40, - 38, 44, 41, 46, 25, 5, 5, 48, 5, 24, - 50, 5, nil, nil, 5, 4, nil, nil, nil, nil, - nil, nil, nil, nil, nil, 5, nil, nil, nil, nil, + 2, 32, 26, 4, 6, 45, 42, 38, 5, 21, + 5, 23, 23, 5, 43, 5, 5, 39, 49, 5, + 47, 32, 5, 1, 36, 5, 33, 38, 5, 3, + 40, 44, 41, 46, 25, 48, 5, 24, 5, 50, + nil, nil, nil, 5, 4, nil, nil, 5, nil, nil, + 5, nil, nil, nil, nil, 5, nil, nil, nil, nil, nil, nil, 2, nil, nil, nil, nil, 2, nil, nil, - nil, 4, nil, 5, 3, 42, 5, nil, 39, nil, - 4, 45, nil, nil, nil, 23, 4, nil, 4, 21, - 49, 47, 39, nil, 36, nil, 43, nil, nil, 2, - nil, nil, nil, 5, 5, nil, nil, nil, nil, nil, - nil, nil, 45, nil, 5, nil, nil, 5, nil, nil, - nil, nil, 2, nil, nil, 5, nil, nil, nil, 5, - 5, 5, nil, nil, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, nil, 5, - 5, nil, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - nil, 6, 33, 5, nil, nil, nil, nil, 21, 26, - nil, nil, nil, 21, 21, nil, 2, 5, nil, 5, - 2, nil, 32, nil, 38, nil, nil, nil, nil, nil, - nil, 2, 5, 5, nil, nil, nil, nil, nil, 4, - nil, nil, nil, nil, 5, 5, 4, nil, nil, nil, + 42, nil, 4, nil, 5, nil, nil, 5, nil, nil, + 21, 4, 45, 39, nil, nil, nil, 4, 3, 4, + nil, 23, 49, nil, 47, 36, 39, nil, nil, 2, + nil, nil, nil, nil, 5, 5, nil, 43, nil, nil, + nil, nil, nil, 45, nil, 5, nil, 5, nil, nil, + nil, 2, nil, nil, nil, nil, 5, nil, nil, nil, + 5, 5, 5, nil, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, nil, + 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 21, 5, 5, + 5, nil, 21, 21, 5, 33, nil, nil, nil, nil, + 26, nil, nil, nil, nil, 32, nil, 2, 5, 5, + 2, 38, nil, nil, nil, nil, nil, nil, nil, nil, + 2, nil, 5, 5, nil, nil, nil, nil, nil, nil, + 4, nil, nil, nil, nil, 5, 5, 4, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, 21, nil, nil, nil, nil, - 2, 4, nil, 21, 5, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 5, 5, nil, 5, - nil, 4, 4, nil, nil, nil, 21, nil, 5, 5, - nil, nil, nil, nil, nil, 4, nil, nil, 4, nil, - nil, 5, nil, nil, 5, nil, nil, nil, nil, nil, - 2, nil, nil, 5, 5 ] + nil, nil, nil, nil, 21, nil, nil, nil, nil, nil, + nil, nil, 21, nil, nil, nil, nil, nil, nil, nil, + 2, nil, 4, nil, nil, 5, nil, nil, nil, nil, + nil, nil, nil, nil, nil, 21, nil, 5, 5, nil, + 5, nil, 4, 4, nil, nil, nil, nil, nil, 5, + 5, nil, nil, nil, nil, nil, 4, nil, nil, 4, + nil, nil, 5, nil, nil, 5, nil, nil, nil, nil, + 2, nil, nil, nil, 5, 5 ] racc_goto_pointer = [ - nil, 26, 0, 19, 2, 2, 1, nil, nil, nil, + nil, 23, 0, 29, 3, 3, -17, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, -6, nil, -184, 37, -147, -1, nil, nil, nil, - nil, nil, -62, 2, nil, nil, -1, nil, -60, -23, - -233, -86, -55, -122, -153, -180, -45, 16, 36, 15, - 39 ] + nil, -17, nil, -178, 35, -147, 0, nil, nil, nil, + nil, nil, -69, 5, nil, nil, -2, nil, -63, -18, + -232, -84, -60, -111, -153, -179, -45, 19, 34, 17, + 38 ] racc_goto_default = [ - nil, nil, 200, nil, nil, 68, 70, 73, 4, 9, - 15, 18, 23, 27, 29, 38, 41, 45, 48, 51, - 56, 60, 63, 98, nil, 69, nil, 6, 11, 17, - 20, 24, 106, 30, 107, 108, nil, 49, 100, nil, + nil, nil, 199, nil, nil, 68, 70, 73, 4, 9, + 15, 18, 23, 27, 29, 37, 39, 43, 46, 50, + 55, 60, 63, 98, nil, 69, nil, 6, 11, 17, + 20, 24, 106, 30, 107, 108, nil, 48, 100, nil, nil, nil, nil, nil, nil, nil, 1, nil, nil, nil, nil ] @@ -1158,12 +1164,12 @@ racc_token_table = { :TYPEOF => 44, :SUPER => 45, :EXTENDS => 46, - :NEWLINE => 47, - :COMMENT => 48, - :JS => 49, - :INDENT => 50, - :OUTDENT => 51, - "?" => 52, + :ASSIGN => 47, + :NEWLINE => 48, + :COMMENT => 49, + :JS => 50, + :INDENT => 51, + :OUTDENT => 52, :UMINUS => 53, :UPLUS => 54, :NOT => 55, @@ -1175,36 +1181,36 @@ racc_token_table = { "*" => 61, "/" => 62, "%" => 63, - "+" => 64, - "-" => 65, - "<<" => 66, - ">>" => 67, - ">>>" => 68, - "&" => 69, - "|" => 70, - "^" => 71, - "<=" => 72, - "<" => 73, - ">" => 74, - ">=" => 75, - "==" => 76, - "!=" => 77, - :IS => 78, - :ISNT => 79, - "&&" => 80, - "||" => 81, - :AND => 82, - :OR => 83, - "-=" => 84, - "+=" => 85, - "/=" => 86, - "*=" => 87, - "%=" => 88, - "." => 89, - "||=" => 90, - "&&=" => 91, - "?=" => 92, - :ASSIGN => 93, + "?" => 64, + "." => 65, + "+" => 66, + "-" => 67, + "<<" => 68, + ">>" => 69, + ">>>" => 70, + "&" => 71, + "|" => 72, + "^" => 73, + "<=" => 74, + "<" => 75, + ">" => 76, + ">=" => 77, + "==" => 78, + "!=" => 79, + :IS => 80, + :ISNT => 81, + "&&" => 82, + "||" => 83, + :AND => 84, + :OR => 85, + "-=" => 86, + "+=" => 87, + "/=" => 88, + "*=" => 89, + "%=" => 90, + "||=" => 91, + "&&=" => 92, + "?=" => 93, "->" => 94, "=>" => 95, "\n" => 96, @@ -1286,12 +1292,12 @@ Racc_token_to_s_table = [ "TYPEOF", "SUPER", "EXTENDS", + "ASSIGN", "NEWLINE", "COMMENT", "JS", "INDENT", "OUTDENT", - "\"?\"", "UMINUS", "UPLUS", "NOT", @@ -1303,6 +1309,8 @@ Racc_token_to_s_table = [ "\"*\"", "\"/\"", "\"%\"", + "\"?\"", + "\".\"", "\"+\"", "\"-\"", "\"<<\"", @@ -1328,11 +1336,9 @@ Racc_token_to_s_table = [ "\"/=\"", "\"*=\"", "\"%=\"", - "\".\"", "\"||=\"", "\"&&=\"", "\"?=\"", - "ASSIGN", "\"->\"", "\"=>\"", "\"\\n\"", @@ -1403,49 +1409,49 @@ Racc_debug_parser = false # reduce 0 omitted -module_eval(<<'.,.,', 'grammar.y', 48) +module_eval(<<'.,.,', 'grammar.y', 45) def _reduce_1(val, _values, result) result = Expressions.new result end .,., -module_eval(<<'.,.,', 'grammar.y', 49) +module_eval(<<'.,.,', 'grammar.y', 46) def _reduce_2(val, _values, result) result = Expressions.new result end .,., -module_eval(<<'.,.,', 'grammar.y', 50) +module_eval(<<'.,.,', 'grammar.y', 47) def _reduce_3(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'grammar.y', 51) +module_eval(<<'.,.,', 'grammar.y', 48) def _reduce_4(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'grammar.y', 56) +module_eval(<<'.,.,', 'grammar.y', 53) def _reduce_5(val, _values, result) result = Expressions.wrap(val) result end .,., -module_eval(<<'.,.,', 'grammar.y', 57) +module_eval(<<'.,.,', 'grammar.y', 54) def _reduce_6(val, _values, result) result = val[0] << val[2] result end .,., -module_eval(<<'.,.,', 'grammar.y', 58) +module_eval(<<'.,.,', 'grammar.y', 55) def _reduce_7(val, _values, result) result = val[0] result @@ -1484,14 +1490,14 @@ module_eval(<<'.,.,', 'grammar.y', 58) # reduce 23 omitted -module_eval(<<'.,.,', 'grammar.y', 85) +module_eval(<<'.,.,', 'grammar.y', 82) def _reduce_24(val, _values, result) result = val[1] result end .,., -module_eval(<<'.,.,', 'grammar.y', 86) +module_eval(<<'.,.,', 'grammar.y', 83) def _reduce_25(val, _values, result) result = Expressions.new result @@ -1502,504 +1508,504 @@ module_eval(<<'.,.,', 'grammar.y', 86) # reduce 27 omitted -module_eval(<<'.,.,', 'grammar.y', 97) +module_eval(<<'.,.,', 'grammar.y', 94) def _reduce_28(val, _values, result) result = LiteralNode.new(val[0]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 98) +module_eval(<<'.,.,', 'grammar.y', 95) def _reduce_29(val, _values, result) result = LiteralNode.new(val[0]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 99) +module_eval(<<'.,.,', 'grammar.y', 96) def _reduce_30(val, _values, result) result = LiteralNode.new(val[0]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 100) +module_eval(<<'.,.,', 'grammar.y', 97) def _reduce_31(val, _values, result) result = LiteralNode.new(val[0]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 101) +module_eval(<<'.,.,', 'grammar.y', 98) def _reduce_32(val, _values, result) result = LiteralNode.new(val[0]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 102) +module_eval(<<'.,.,', 'grammar.y', 99) def _reduce_33(val, _values, result) result = LiteralNode.new(val[0]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 103) +module_eval(<<'.,.,', 'grammar.y', 100) def _reduce_34(val, _values, result) result = LiteralNode.new(Value.new(true)) result end .,., -module_eval(<<'.,.,', 'grammar.y', 104) +module_eval(<<'.,.,', 'grammar.y', 101) def _reduce_35(val, _values, result) result = LiteralNode.new(Value.new(false)) result end .,., -module_eval(<<'.,.,', 'grammar.y', 105) +module_eval(<<'.,.,', 'grammar.y', 102) def _reduce_36(val, _values, result) result = LiteralNode.new(Value.new(true)) result end .,., -module_eval(<<'.,.,', 'grammar.y', 106) +module_eval(<<'.,.,', 'grammar.y', 103) def _reduce_37(val, _values, result) result = LiteralNode.new(Value.new(false)) result end .,., -module_eval(<<'.,.,', 'grammar.y', 107) +module_eval(<<'.,.,', 'grammar.y', 104) def _reduce_38(val, _values, result) result = LiteralNode.new(Value.new(true)) result end .,., -module_eval(<<'.,.,', 'grammar.y', 108) +module_eval(<<'.,.,', 'grammar.y', 105) def _reduce_39(val, _values, result) result = LiteralNode.new(Value.new(false)) result end .,., -module_eval(<<'.,.,', 'grammar.y', 113) +module_eval(<<'.,.,', 'grammar.y', 110) def _reduce_40(val, _values, result) result = AssignNode.new(val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 118) +module_eval(<<'.,.,', 'grammar.y', 115) def _reduce_41(val, _values, result) result = AssignNode.new(ValueNode.new(val[0]), val[2], :object) result end .,., -module_eval(<<'.,.,', 'grammar.y', 119) +module_eval(<<'.,.,', 'grammar.y', 116) def _reduce_42(val, _values, result) result = AssignNode.new(ValueNode.new(LiteralNode.new(val[0])), val[2], :object) result end .,., -module_eval(<<'.,.,', 'grammar.y', 120) +module_eval(<<'.,.,', 'grammar.y', 117) def _reduce_43(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'grammar.y', 125) +module_eval(<<'.,.,', 'grammar.y', 122) def _reduce_44(val, _values, result) result = ReturnNode.new(val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 126) +module_eval(<<'.,.,', 'grammar.y', 123) def _reduce_45(val, _values, result) result = ReturnNode.new(ValueNode.new(Value.new('null'))) result end .,., -module_eval(<<'.,.,', 'grammar.y', 131) +module_eval(<<'.,.,', 'grammar.y', 128) def _reduce_46(val, _values, result) result = CommentNode.new(val[0]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 138) +module_eval(<<'.,.,', 'grammar.y', 135) def _reduce_47(val, _values, result) result = OpNode.new(val[0], val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 139) +module_eval(<<'.,.,', 'grammar.y', 136) def _reduce_48(val, _values, result) result = OpNode.new(val[0], val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 140) +module_eval(<<'.,.,', 'grammar.y', 137) def _reduce_49(val, _values, result) result = OpNode.new(val[0], val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 141) +module_eval(<<'.,.,', 'grammar.y', 138) def _reduce_50(val, _values, result) result = OpNode.new(val[0], val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 142) +module_eval(<<'.,.,', 'grammar.y', 139) def _reduce_51(val, _values, result) result = OpNode.new(val[0], val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 143) +module_eval(<<'.,.,', 'grammar.y', 140) def _reduce_52(val, _values, result) result = OpNode.new(val[0], val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 144) +module_eval(<<'.,.,', 'grammar.y', 141) def _reduce_53(val, _values, result) result = OpNode.new(val[0], val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 145) +module_eval(<<'.,.,', 'grammar.y', 142) def _reduce_54(val, _values, result) result = OpNode.new(val[0], val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 146) +module_eval(<<'.,.,', 'grammar.y', 143) def _reduce_55(val, _values, result) result = OpNode.new(val[0], val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 147) +module_eval(<<'.,.,', 'grammar.y', 144) def _reduce_56(val, _values, result) result = OpNode.new(val[0], val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 148) +module_eval(<<'.,.,', 'grammar.y', 145) def _reduce_57(val, _values, result) result = OpNode.new(val[1], val[0], nil, true) result end .,., -module_eval(<<'.,.,', 'grammar.y', 149) +module_eval(<<'.,.,', 'grammar.y', 146) def _reduce_58(val, _values, result) result = OpNode.new(val[1], val[0], nil, true) result end .,., -module_eval(<<'.,.,', 'grammar.y', 151) +module_eval(<<'.,.,', 'grammar.y', 148) def _reduce_59(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 152) +module_eval(<<'.,.,', 'grammar.y', 149) def _reduce_60(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 153) +module_eval(<<'.,.,', 'grammar.y', 150) def _reduce_61(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 155) +module_eval(<<'.,.,', 'grammar.y', 152) def _reduce_62(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 156) +module_eval(<<'.,.,', 'grammar.y', 153) def _reduce_63(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 158) +module_eval(<<'.,.,', 'grammar.y', 155) def _reduce_64(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 159) +module_eval(<<'.,.,', 'grammar.y', 156) def _reduce_65(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 160) +module_eval(<<'.,.,', 'grammar.y', 157) def _reduce_66(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 162) +module_eval(<<'.,.,', 'grammar.y', 159) def _reduce_67(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 163) +module_eval(<<'.,.,', 'grammar.y', 160) def _reduce_68(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 164) +module_eval(<<'.,.,', 'grammar.y', 161) def _reduce_69(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 166) +module_eval(<<'.,.,', 'grammar.y', 163) def _reduce_70(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 167) +module_eval(<<'.,.,', 'grammar.y', 164) def _reduce_71(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 168) +module_eval(<<'.,.,', 'grammar.y', 165) def _reduce_72(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 169) +module_eval(<<'.,.,', 'grammar.y', 166) def _reduce_73(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 171) +module_eval(<<'.,.,', 'grammar.y', 168) def _reduce_74(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 172) +module_eval(<<'.,.,', 'grammar.y', 169) def _reduce_75(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 173) +module_eval(<<'.,.,', 'grammar.y', 170) def _reduce_76(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 174) +module_eval(<<'.,.,', 'grammar.y', 171) def _reduce_77(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 176) +module_eval(<<'.,.,', 'grammar.y', 173) def _reduce_78(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 177) +module_eval(<<'.,.,', 'grammar.y', 174) def _reduce_79(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 178) +module_eval(<<'.,.,', 'grammar.y', 175) def _reduce_80(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 179) +module_eval(<<'.,.,', 'grammar.y', 176) def _reduce_81(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 180) +module_eval(<<'.,.,', 'grammar.y', 177) def _reduce_82(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 182) +module_eval(<<'.,.,', 'grammar.y', 179) def _reduce_83(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 183) +module_eval(<<'.,.,', 'grammar.y', 180) def _reduce_84(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 184) +module_eval(<<'.,.,', 'grammar.y', 181) def _reduce_85(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 185) +module_eval(<<'.,.,', 'grammar.y', 182) def _reduce_86(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 186) +module_eval(<<'.,.,', 'grammar.y', 183) def _reduce_87(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 187) +module_eval(<<'.,.,', 'grammar.y', 184) def _reduce_88(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 188) +module_eval(<<'.,.,', 'grammar.y', 185) def _reduce_89(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 189) +module_eval(<<'.,.,', 'grammar.y', 186) def _reduce_90(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 191) +module_eval(<<'.,.,', 'grammar.y', 188) def _reduce_91(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 192) +module_eval(<<'.,.,', 'grammar.y', 189) def _reduce_92(val, _values, result) result = OpNode.new(val[1], val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 197) +module_eval(<<'.,.,', 'grammar.y', 194) def _reduce_93(val, _values, result) result = ExistenceNode.new(val[0]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 203) +module_eval(<<'.,.,', 'grammar.y', 200) def _reduce_94(val, _values, result) result = CodeNode.new(val[1], val[4], val[3]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 204) +module_eval(<<'.,.,', 'grammar.y', 201) def _reduce_95(val, _values, result) result = CodeNode.new([], val[1], val[0]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 209) +module_eval(<<'.,.,', 'grammar.y', 206) def _reduce_96(val, _values, result) result = :func result end .,., -module_eval(<<'.,.,', 'grammar.y', 210) +module_eval(<<'.,.,', 'grammar.y', 207) def _reduce_97(val, _values, result) result = :boundfunc result end .,., -module_eval(<<'.,.,', 'grammar.y', 215) +module_eval(<<'.,.,', 'grammar.y', 212) def _reduce_98(val, _values, result) result = val result end .,., -module_eval(<<'.,.,', 'grammar.y', 216) +module_eval(<<'.,.,', 'grammar.y', 213) def _reduce_99(val, _values, result) result = val[0] << val[2] result @@ -2008,588 +2014,588 @@ module_eval(<<'.,.,', 'grammar.y', 216) # reduce 100 omitted -module_eval(<<'.,.,', 'grammar.y', 222) +module_eval(<<'.,.,', 'grammar.y', 219) def _reduce_101(val, _values, result) result = SplatNode.new(val[0]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 227) +module_eval(<<'.,.,', 'grammar.y', 224) def _reduce_102(val, _values, result) result = SplatNode.new(val[0]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 232) +module_eval(<<'.,.,', 'grammar.y', 229) def _reduce_103(val, _values, result) result = ValueNode.new(val[0]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 233) +module_eval(<<'.,.,', 'grammar.y', 230) def _reduce_104(val, _values, result) result = ValueNode.new(val[0]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 234) +module_eval(<<'.,.,', 'grammar.y', 231) def _reduce_105(val, _values, result) result = ValueNode.new(val[0]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 235) +module_eval(<<'.,.,', 'grammar.y', 232) def _reduce_106(val, _values, result) result = ValueNode.new(val[0]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 236) +module_eval(<<'.,.,', 'grammar.y', 233) def _reduce_107(val, _values, result) result = ValueNode.new(val[0]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 237) +module_eval(<<'.,.,', 'grammar.y', 234) def _reduce_108(val, _values, result) result = ValueNode.new(val[0]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 238) +module_eval(<<'.,.,', 'grammar.y', 235) def _reduce_109(val, _values, result) result = ValueNode.new(val[0]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 239) +module_eval(<<'.,.,', 'grammar.y', 236) def _reduce_110(val, _values, result) result = val[0] << val[1] result end .,., -module_eval(<<'.,.,', 'grammar.y', 240) +module_eval(<<'.,.,', 'grammar.y', 237) def _reduce_111(val, _values, result) result = ValueNode.new(val[0], [val[1]]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 245) +module_eval(<<'.,.,', 'grammar.y', 242) def _reduce_112(val, _values, result) result = AccessorNode.new(val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 246) +module_eval(<<'.,.,', 'grammar.y', 243) def _reduce_113(val, _values, result) result = AccessorNode.new(val[1], :prototype) result end .,., -module_eval(<<'.,.,', 'grammar.y', 247) +module_eval(<<'.,.,', 'grammar.y', 244) def _reduce_114(val, _values, result) result = AccessorNode.new(val[1], :soak) result end .,., -module_eval(<<'.,.,', 'grammar.y', 248) +module_eval(<<'.,.,', 'grammar.y', 245) def _reduce_115(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'grammar.y', 249) +module_eval(<<'.,.,', 'grammar.y', 246) def _reduce_116(val, _values, result) result = SliceNode.new(val[0]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 254) +module_eval(<<'.,.,', 'grammar.y', 251) def _reduce_117(val, _values, result) result = IndexNode.new(val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 259) +module_eval(<<'.,.,', 'grammar.y', 256) def _reduce_118(val, _values, result) result = ObjectNode.new(val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 264) +module_eval(<<'.,.,', 'grammar.y', 261) def _reduce_119(val, _values, result) result = [] result end .,., -module_eval(<<'.,.,', 'grammar.y', 265) +module_eval(<<'.,.,', 'grammar.y', 262) def _reduce_120(val, _values, result) result = val result end .,., -module_eval(<<'.,.,', 'grammar.y', 266) +module_eval(<<'.,.,', 'grammar.y', 263) def _reduce_121(val, _values, result) result = val[0] << val[2] result end .,., -module_eval(<<'.,.,', 'grammar.y', 267) +module_eval(<<'.,.,', 'grammar.y', 264) def _reduce_122(val, _values, result) result = val[0] << val[2] result end .,., -module_eval(<<'.,.,', 'grammar.y', 269) +module_eval(<<'.,.,', 'grammar.y', 266) def _reduce_123(val, _values, result) result = val[0] << val[3] result end .,., -module_eval(<<'.,.,', 'grammar.y', 270) +module_eval(<<'.,.,', 'grammar.y', 267) def _reduce_124(val, _values, result) result = val[1] result end .,., -module_eval(<<'.,.,', 'grammar.y', 275) +module_eval(<<'.,.,', 'grammar.y', 272) def _reduce_125(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'grammar.y', 276) +module_eval(<<'.,.,', 'grammar.y', 273) def _reduce_126(val, _values, result) result = val[1].new_instance result end .,., -module_eval(<<'.,.,', 'grammar.y', 277) +module_eval(<<'.,.,', 'grammar.y', 274) def _reduce_127(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'grammar.y', 282) +module_eval(<<'.,.,', 'grammar.y', 279) def _reduce_128(val, _values, result) result = ExtendsNode.new(val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 287) +module_eval(<<'.,.,', 'grammar.y', 284) def _reduce_129(val, _values, result) result = CallNode.new(val[0], val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 288) +module_eval(<<'.,.,', 'grammar.y', 285) def _reduce_130(val, _values, result) result = CallNode.new(val[0], val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 293) +module_eval(<<'.,.,', 'grammar.y', 290) def _reduce_131(val, _values, result) result = val[1] result end .,., -module_eval(<<'.,.,', 'grammar.y', 298) +module_eval(<<'.,.,', 'grammar.y', 295) def _reduce_132(val, _values, result) result = CallNode.new(Value.new('super'), val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 303) +module_eval(<<'.,.,', 'grammar.y', 300) def _reduce_133(val, _values, result) result = ThisNode.new result end .,., -module_eval(<<'.,.,', 'grammar.y', 304) +module_eval(<<'.,.,', 'grammar.y', 301) def _reduce_134(val, _values, result) result = ThisNode.new(val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 310) +module_eval(<<'.,.,', 'grammar.y', 307) def _reduce_135(val, _values, result) result = RangeNode.new(val[1], val[4]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 312) +module_eval(<<'.,.,', 'grammar.y', 309) def _reduce_136(val, _values, result) result = RangeNode.new(val[1], val[5], true) result end .,., -module_eval(<<'.,.,', 'grammar.y', 318) +module_eval(<<'.,.,', 'grammar.y', 315) def _reduce_137(val, _values, result) result = RangeNode.new(val[1], val[4]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 320) +module_eval(<<'.,.,', 'grammar.y', 317) def _reduce_138(val, _values, result) result = RangeNode.new(val[1], val[5], true) result end .,., -module_eval(<<'.,.,', 'grammar.y', 325) +module_eval(<<'.,.,', 'grammar.y', 322) def _reduce_139(val, _values, result) result = ArrayNode.new(val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 330) +module_eval(<<'.,.,', 'grammar.y', 327) def _reduce_140(val, _values, result) result = [] result end .,., -module_eval(<<'.,.,', 'grammar.y', 331) +module_eval(<<'.,.,', 'grammar.y', 328) def _reduce_141(val, _values, result) result = val result end .,., -module_eval(<<'.,.,', 'grammar.y', 332) +module_eval(<<'.,.,', 'grammar.y', 329) def _reduce_142(val, _values, result) result = [val[1]] result end .,., -module_eval(<<'.,.,', 'grammar.y', 333) +module_eval(<<'.,.,', 'grammar.y', 330) def _reduce_143(val, _values, result) result = val[0] << val[2] result end .,., -module_eval(<<'.,.,', 'grammar.y', 334) +module_eval(<<'.,.,', 'grammar.y', 331) def _reduce_144(val, _values, result) result = val[0] << val[2] result end .,., -module_eval(<<'.,.,', 'grammar.y', 335) +module_eval(<<'.,.,', 'grammar.y', 332) def _reduce_145(val, _values, result) result = val[0] << val[3] result end .,., -module_eval(<<'.,.,', 'grammar.y', 336) +module_eval(<<'.,.,', 'grammar.y', 333) def _reduce_146(val, _values, result) result = val[0] << val[3] result end .,., -module_eval(<<'.,.,', 'grammar.y', 337) +module_eval(<<'.,.,', 'grammar.y', 334) def _reduce_147(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'grammar.y', 342) +module_eval(<<'.,.,', 'grammar.y', 339) def _reduce_148(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'grammar.y', 343) +module_eval(<<'.,.,', 'grammar.y', 340) def _reduce_149(val, _values, result) result = ([val[0]] << val[2]).flatten result end .,., -module_eval(<<'.,.,', 'grammar.y', 348) +module_eval(<<'.,.,', 'grammar.y', 345) def _reduce_150(val, _values, result) result = TryNode.new(val[1], val[2][0], val[2][1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 349) +module_eval(<<'.,.,', 'grammar.y', 346) def _reduce_151(val, _values, result) result = TryNode.new(val[1], nil, nil, val[3]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 351) +module_eval(<<'.,.,', 'grammar.y', 348) def _reduce_152(val, _values, result) result = TryNode.new(val[1], val[2][0], val[2][1], val[4]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 356) +module_eval(<<'.,.,', 'grammar.y', 353) def _reduce_153(val, _values, result) result = [val[1], val[2]] result end .,., -module_eval(<<'.,.,', 'grammar.y', 361) +module_eval(<<'.,.,', 'grammar.y', 358) def _reduce_154(val, _values, result) result = ThrowNode.new(val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 366) +module_eval(<<'.,.,', 'grammar.y', 363) def _reduce_155(val, _values, result) result = ParentheticalNode.new(val[1], val[0].line) result end .,., -module_eval(<<'.,.,', 'grammar.y', 371) +module_eval(<<'.,.,', 'grammar.y', 368) def _reduce_156(val, _values, result) result = WhileNode.new(val[1], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 372) +module_eval(<<'.,.,', 'grammar.y', 369) def _reduce_157(val, _values, result) result = WhileNode.new(val[1], nil) result end .,., -module_eval(<<'.,.,', 'grammar.y', 373) +module_eval(<<'.,.,', 'grammar.y', 370) def _reduce_158(val, _values, result) result = WhileNode.new(val[2], Expressions.wrap(val[0])) result end .,., -module_eval(<<'.,.,', 'grammar.y', 380) +module_eval(<<'.,.,', 'grammar.y', 377) def _reduce_159(val, _values, result) result = ForNode.new(val[0], val[3], val[2][0], val[2][1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 381) +module_eval(<<'.,.,', 'grammar.y', 378) def _reduce_160(val, _values, result) result = ForNode.new(val[3], val[2], val[1][0], val[1][1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 386) +module_eval(<<'.,.,', 'grammar.y', 383) def _reduce_161(val, _values, result) result = val result end .,., -module_eval(<<'.,.,', 'grammar.y', 387) +module_eval(<<'.,.,', 'grammar.y', 384) def _reduce_162(val, _values, result) result = [val[0], val[2]] result end .,., -module_eval(<<'.,.,', 'grammar.y', 392) +module_eval(<<'.,.,', 'grammar.y', 389) def _reduce_163(val, _values, result) result = {:source => val[1]} result end .,., -module_eval(<<'.,.,', 'grammar.y', 393) +module_eval(<<'.,.,', 'grammar.y', 390) def _reduce_164(val, _values, result) result = {:source => val[1], :object => true} result end .,., -module_eval(<<'.,.,', 'grammar.y', 395) +module_eval(<<'.,.,', 'grammar.y', 392) def _reduce_165(val, _values, result) result = val[0].merge(:filter => val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 397) +module_eval(<<'.,.,', 'grammar.y', 394) def _reduce_166(val, _values, result) result = val[0].merge(:step => val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 403) +module_eval(<<'.,.,', 'grammar.y', 400) def _reduce_167(val, _values, result) result = val[3].rewrite_condition(val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 405) +module_eval(<<'.,.,', 'grammar.y', 402) def _reduce_168(val, _values, result) result = val[3].rewrite_condition(val[1]).add_else(val[5]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 410) +module_eval(<<'.,.,', 'grammar.y', 407) def _reduce_169(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'grammar.y', 411) +module_eval(<<'.,.,', 'grammar.y', 408) def _reduce_170(val, _values, result) result = val[0] << val[1] result end .,., -module_eval(<<'.,.,', 'grammar.y', 416) +module_eval(<<'.,.,', 'grammar.y', 413) def _reduce_171(val, _values, result) result = IfNode.new(val[1], val[2], nil, {:statement => true}) result end .,., -module_eval(<<'.,.,', 'grammar.y', 418) +module_eval(<<'.,.,', 'grammar.y', 415) def _reduce_172(val, _values, result) result = IfNode.new(val[1], val[2], nil, {:statement => true}) result end .,., -module_eval(<<'.,.,', 'grammar.y', 419) +module_eval(<<'.,.,', 'grammar.y', 416) def _reduce_173(val, _values, result) result = val[2].add_comment(val[0]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 424) +module_eval(<<'.,.,', 'grammar.y', 421) def _reduce_174(val, _values, result) result = IfNode.new(val[1], val[2]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 429) +module_eval(<<'.,.,', 'grammar.y', 426) def _reduce_175(val, _values, result) result = val[1].force_statement result end .,., -module_eval(<<'.,.,', 'grammar.y', 434) +module_eval(<<'.,.,', 'grammar.y', 431) def _reduce_176(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'grammar.y', 435) +module_eval(<<'.,.,', 'grammar.y', 432) def _reduce_177(val, _values, result) result = val[0].add_else(val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 440) +module_eval(<<'.,.,', 'grammar.y', 437) def _reduce_178(val, _values, result) result = nil result end .,., -module_eval(<<'.,.,', 'grammar.y', 441) +module_eval(<<'.,.,', 'grammar.y', 438) def _reduce_179(val, _values, result) result = val[1] result end .,., -module_eval(<<'.,.,', 'grammar.y', 446) +module_eval(<<'.,.,', 'grammar.y', 443) def _reduce_180(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'grammar.y', 447) +module_eval(<<'.,.,', 'grammar.y', 444) def _reduce_181(val, _values, result) result = val[0].add_else(val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 452) +module_eval(<<'.,.,', 'grammar.y', 449) def _reduce_182(val, _values, result) result = val[0].add_else(val[1]) result end .,., -module_eval(<<'.,.,', 'grammar.y', 453) +module_eval(<<'.,.,', 'grammar.y', 450) def _reduce_183(val, _values, result) result = IfNode.new(val[2], Expressions.wrap(val[0]), nil, {:statement => true}) result end .,., -module_eval(<<'.,.,', 'grammar.y', 454) +module_eval(<<'.,.,', 'grammar.y', 451) def _reduce_184(val, _values, result) result = IfNode.new(val[2], Expressions.wrap(val[0]), nil, {:statement => true, :invert => true}) result diff --git a/lib/coffee_script/repl.js b/lib/coffee_script/repl.js new file mode 100644 index 00000000..0a0dfee4 --- /dev/null +++ b/lib/coffee_script/repl.js @@ -0,0 +1,33 @@ +(function(){ + var coffee, prompt, quit, readline, run; + // A CoffeeScript port/version of the Node.js REPL. + // Required modules. + coffee = require('./coffee-script'); + process.mixin(require('sys')); + // Shortcut variables. + prompt = 'coffee> '; + quit = function quit() { + return process.stdio.close(); + }; + // The main REPL function. Called everytime a line of code is entered. + readline = function readline(code) { + return coffee.compile(code, run); + }; + // Attempt to evaluate the command. If there's an exception, print it. + run = function run(js) { + var val; + try { + val = eval(js); + if (val !== undefined) { + p(val); + } + } catch (err) { + puts(err.stack || err.toString()); + } + return print(prompt); + }; + // Start up the REPL. + process.stdio.open(); + process.stdio.addListener('data', readline); + print(prompt); +})(); \ No newline at end of file diff --git a/lib/coffee_script/rewriter.js b/lib/coffee_script/rewriter.js new file mode 100644 index 00000000..f20af785 --- /dev/null +++ b/lib/coffee_script/rewriter.js @@ -0,0 +1,377 @@ +(function(){ + var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_START, EXPRESSION_TAIL, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, INVERSES, SINGLE_CLOSERS, SINGLE_LINERS, __a, __b, __c, __d, __e, __f, __g, __h, pair, re; + var __hasProp = Object.prototype.hasOwnProperty; + // In order to keep the grammar simple, the stream of tokens that the Lexer + // emits is rewritten by the Rewriter, smoothing out ambiguities, mis-nested + // indentation, and single-line flavors of expressions. + exports.Rewriter = (re = function re() { }); + // Tokens that must be balanced. + BALANCED_PAIRS = [['(', ')'], ['[', ']'], ['{', '}'], ['INDENT', 'OUTDENT'], ['PARAM_START', 'PARAM_END'], ['CALL_START', 'CALL_END'], ['INDEX_START', 'INDEX_END']]; + // Tokens that signal the start of a balanced pair. + EXPRESSION_START = (function() { + __a = []; __b = BALANCED_PAIRS; + for (__c = 0; __c < __b.length; __c++) { + pair = __b[__c]; + __a.push(pair[0]); + } + return __a; + }).call(this); + // Tokens that signal the end of a balanced pair. + EXPRESSION_TAIL = (function() { + __d = []; __e = BALANCED_PAIRS; + for (__f = 0; __f < __e.length; __f++) { + pair = __e[__f]; + __d.push(pair[1]); + } + return __d; + }).call(this); + // Tokens that indicate the close of a clause of an expression. + EXPRESSION_CLOSE = ['CATCH', 'WHEN', 'ELSE', 'FINALLY'].concat(EXPRESSION_TAIL); + // Tokens pairs that, in immediate succession, indicate an implicit call. + IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END']; + IMPLICIT_END = ['IF', 'UNLESS', 'FOR', 'WHILE', "\n", 'OUTDENT']; + IMPLICIT_CALL = ['IDENTIFIER', 'NUMBER', 'STRING', 'JS', 'REGEX', 'NEW', 'PARAM_START', 'TRY', 'DELETE', 'TYPEOF', 'SWITCH', 'ARGUMENTS', 'TRUE', 'FALSE', 'YES', 'NO', 'ON', 'OFF', '!', '!!', 'NOT', '->', '=>', '[', '(', '{']; + // The inverse mappings of token pairs we're trying to fix up. + INVERSES = { + }; + __g = BALANCED_PAIRS; + for (__h = 0; __h < __g.length; __h++) { + pair = __g[__h]; + INVERSES[pair[0]] = pair[1]; + INVERSES[pair[1]] = pair[0]; + } + // Single-line flavors of block expressions that have unclosed endings. + // The grammar can't disambiguate them, so we insert the implicit indentation. + SINGLE_LINERS = ['ELSE', "->", "=>", 'TRY', 'FINALLY', 'THEN']; + SINGLE_CLOSERS = ["\n", 'CATCH', 'FINALLY', 'ELSE', 'OUTDENT', 'LEADING_WHEN', 'PARAM_START']; + // Rewrite the token stream in multiple passes, one logical filter at + // a time. This could certainly be changed into a single pass through the + // stream, with a big ol' efficient switch, but it's much nicer like this. + re.prototype.rewrite = function rewrite(tokens) { + this.tokens = tokens; + this.adjust_comments(); + this.remove_leading_newlines(); + this.remove_mid_expression_newlines(); + this.move_commas_outside_outdents(); + this.close_open_calls_and_indexes(); + this.add_implicit_parentheses(); + this.add_implicit_indentation(); + this.ensure_balance(BALANCED_PAIRS); + this.rewrite_closing_parens(); + return this.tokens; + }; + // Rewrite the token stream, looking one token ahead and behind. + // Allow the return value of the block to tell us how many tokens to move + // forwards (or backwards) in the stream, to make sure we don't miss anything + // as the stream changes length under our feet. + re.prototype.scan_tokens = function scan_tokens(yield) { + var i, move; + i = 0; + while (true) { + if (!(this.tokens[i])) { + break; + } + move = yield(this.tokens[i - 1], this.tokens[i], this.tokens[i + 1], i); + i += move; + } + return true; + }; + // Massage newlines and indentations so that comments don't have to be + // correctly indented, or appear on their own line. + re.prototype.adjust_comments = function adjust_comments() { + return this.scan_tokens((function(__this) { + var __func = function(prev, token, post, i) { + var after, before; + if (!(token[0] === 'COMMENT')) { + return 1; + } + before = this.tokens[i - 2]; + after = this.tokens[i + 2]; + if (before && after && ((before[0] === 'INDENT' && after[0] === 'OUTDENT') || (before[0] === 'OUTDENT' && after[0] === 'INDENT')) && before[1] === after[1]) { + this.tokens.splice(i + 2, 1); + this.tokens.splice(i - 2, 1); + return 0; + } else if (prev[0] === "\n" && after[0] === 'INDENT') { + this.tokens.splice(i + 2, 1); + this.tokens[i - 1] = after; + return 1; + } else if (prev[0] !== "\n" && prev[0] !== 'INDENT' && prev[0] !== 'OUTDENT') { + this.tokens.splice(i, 0, ["\n", "\n"]); + return 2; + } else { + return 1; + } + }; + return (function() { + return __func.apply(__this, arguments); + }); + })(this)); + }; + // Leading newlines would introduce an ambiguity in the grammar, so we + // dispatch them here. + re.prototype.remove_leading_newlines = function remove_leading_newlines() { + if (this.tokens[0][0] === "\n") { + return this.tokens.shift(); + } + }; + // Some blocks occur in the middle of expressions -- when we're expecting + // this, remove their trailing newlines. + re.prototype.remove_mid_expression_newlines = function remove_mid_expression_newlines() { + return this.scan_tokens((function(__this) { + var __func = function(prev, token, post, i) { + if (!(post && EXPRESSION_CLOSE.indexOf(post[0]) >= 0 && token[0] === "\n")) { + return 1; + } + this.tokens.splice(i, 1); + return 0; + }; + return (function() { + return __func.apply(__this, arguments); + }); + })(this)); + }; + // Make sure that we don't accidentally break trailing commas, which need + // to go on the outside of expression closers. + re.prototype.move_commas_outside_outdents = function move_commas_outside_outdents() { + return this.scan_tokens((function(__this) { + var __func = function(prev, token, post, i) { + if (token[0] === 'OUTDENT' && prev[0] === ',') { + this.tokens.splice(i, 1, token); + } + return 1; + }; + return (function() { + return __func.apply(__this, arguments); + }); + })(this)); + }; + // We've tagged the opening parenthesis of a method call, and the opening + // bracket of an indexing operation. Match them with their close. + re.prototype.close_open_calls_and_indexes = function close_open_calls_and_indexes() { + var brackets, parens; + parens = [0]; + brackets = [0]; + return this.scan_tokens((function(__this) { + var __func = function(prev, token, post, i) { + if (token[0] === 'CALL_START') { + parens.push(0); + } else if (token[0] === 'INDEX_START') { + brackets.push(0); + } else if (token[0] === '(') { + parens[parens.length - 1] += 1; + } else if (token[0] === '[') { + brackets[brackets.length - 1] += 1; + } else if (token[0] === ')') { + if (parens[parens.length - 1] === 0) { + parens.pop(); + token[0] = 'CALL_END'; + } else { + parens[parens.length - 1] -= 1; + } + } else if (token[0] === ']') { + if (brackets[brackets.length - 1] === 0) { + brackets.pop(); + token[0] = 'INDEX_END'; + } else { + brackets[brackets.length - 1] -= 1; + } + } + return 1; + }; + return (function() { + return __func.apply(__this, arguments); + }); + })(this)); + }; + // Methods may be optionally called without parentheses, for simple cases. + // Insert the implicit parentheses here, so that the parser doesn't have to + // deal with them. + re.prototype.add_implicit_parentheses = function add_implicit_parentheses() { + var stack; + stack = [0]; + return this.scan_tokens((function(__this) { + var __func = function(prev, token, post, i) { + var __i, __j, __k, __l, idx, last, size, tmp; + if (token[0] === 'INDENT') { + stack.push(0); + } + if (token[0] === 'OUTDENT') { + last = stack.pop(); + stack[stack.length - 1] += last; + } + if (stack[stack.length - 1] > 0 && (IMPLICIT_END.indexOf(token[0]) >= 0 || (typeof !post !== "undefined" && !post !== null))) { + idx = token[0] === 'OUTDENT' ? i + 1 : i; + __k = 0; __l = stack[stack.length - 1]; + for (__j=0, tmp=__k; (__k <= __l ? tmp < __l : tmp > __l); (__k <= __l ? tmp += 1 : tmp -= 1), __j++) { + this.tokens.splice(idx, 0, ['CALL_END', ')']); + } + size = stack[stack.length - 1] + 1; + stack[stack.length - 1] = 0; + return size; + } + if (!(prev && IMPLICIT_FUNC.indexOf(prev[0]) >= 0 && IMPLICIT_CALL.indexOf(token[0]) >= 0)) { + return 1; + } + this.tokens.splice(i, 0, ['CALL_START', '(']); + stack[stack.length - 1] += 1; + return 2; + }; + return (function() { + return __func.apply(__this, arguments); + }); + })(this)); + }; + // Because our grammar is LALR(1), it can't handle some single-line + // expressions that lack ending delimiters. Use the lexer to add the implicit + // blocks, so it doesn't need to. + // ')' can close a single-line block, but we need to make sure it's balanced. + re.prototype.add_implicit_indentation = function add_implicit_indentation() { + return this.scan_tokens((function(__this) { + var __func = function(prev, token, post, i) { + var idx, insertion, parens, starter, tok; + if (!(SINGLE_LINERS.indexOf(token[0]) >= 0 && post[0] !== 'INDENT' && !(token[0] === 'ELSE' && post[0] === 'IF'))) { + return 1; + } + starter = token[0]; + this.tokens.splice(i + 1, 0, ['INDENT', 2]); + idx = i + 1; + parens = 0; + while (true) { + idx += 1; + tok = this.tokens[idx]; + if ((!tok || SINGLE_CLOSERS.indexOf(tok[0]) >= 0 || (tok[0] === ')' && parens === 0)) && !(starter === 'ELSE' && tok[0] === 'ELSE')) { + insertion = this.tokens[idx - 1][0] === "," ? idx - 1 : idx; + this.tokens.splice(insertion, 0, ['OUTDENT', 2]); + break; + } + if (tok[0] === '(') { + parens += 1; + } + if (tok[0] === ')') { + parens -= 1; + } + } + if (!(token[0] === 'THEN')) { + return 1; + } + this.tokens.splice(i, 1); + return 0; + }; + return (function() { + return __func.apply(__this, arguments); + }); + })(this)); + }; + // Ensure that all listed pairs of tokens are correctly balanced throughout + // the course of the token stream. + re.prototype.ensure_balance = function ensure_balance(pairs) { + var __i, __j, key, levels, unclosed, value; + levels = { + }; + this.scan_tokens((function(__this) { + var __func = function(prev, token, post, i) { + var __i, __j, __k, close, open; + __i = pairs; + for (__j = 0; __j < __i.length; __j++) { + pair = __i[__j]; + __k = pair; + open = __k[0]; + close = __k[1]; + levels[open] = levels[open] || 0; + if (token[0] === open) { + levels[open] += 1; + } + if (token[0] === close) { + levels[open] -= 1; + } + if (levels[open] < 0) { + throw "too many " + token[1]; + } + } + return 1; + }; + return (function() { + return __func.apply(__this, arguments); + }); + })(this)); + unclosed = (function() { + __i = []; __j = levels; + for (key in __j) { + value = __j[key]; + if (__hasProp.call(__j, key)) { + if (value > 0) { + __i.push(key); + } + } + } + return __i; + }).call(this); + if (unclosed.length) { + throw "unclosed " + unclosed[0]; + } + }; + // We'd like to support syntax like this: + // el.click((event) -> + // el.hide()) + // In order to accomplish this, move outdents that follow closing parens + // inwards, safely. The steps to accomplish this are: + // + // 1. Check that all paired tokens are balanced and in order. + // 2. Rewrite the stream with a stack: if you see an '(' or INDENT, add it + // to the stack. If you see an ')' or OUTDENT, pop the stack and replace + // it with the inverse of what we've just popped. + // 3. Keep track of "debt" for tokens that we fake, to make sure we end + // up balanced in the end. + re.prototype.rewrite_closing_parens = function rewrite_closing_parens() { + var __i, debt, key, stack, val; + stack = []; + debt = { + }; + __i = INVERSES; + for (key in __i) { + val = __i[key]; + if (__hasProp.call(__i, key)) { + ((debt[key] = 0)); + } + } + return this.scan_tokens((function(__this) { + var __func = function(prev, token, post, i) { + var inv, match, mtag, tag; + tag = token[0]; + inv = INVERSES[token[0]]; + // Push openers onto the stack. + if (EXPRESSION_START.indexOf(tag) >= 0) { + stack.push(token); + return 1; + // The end of an expression, check stack and debt for a pair. + } else if (EXPRESSION_TAIL.indexOf(tag) >= 0) { + // If the tag is already in our debt, swallow it. + if (debt[inv] > 0) { + debt[inv] -= 1; + this.tokens.splice(i, 1); + return 0; + } else { + // Pop the stack of open delimiters. + match = stack.pop(); + mtag = match[0]; + // Continue onwards if it's the expected tag. + if (tag === INVERSES[mtag]) { + return 1; + } else { + // Unexpected close, insert correct close, adding to the debt. + debt[mtag] += 1; + val = mtag === 'INDENT' ? match[1] : INVERSES[mtag]; + this.tokens.splice(i, 0, [INVERSES[mtag], val]); + return 1; + } + } + } else { + return 1; + } + }; + return (function() { + return __func.apply(__this, arguments); + }); + })(this)); + }; +})(); \ No newline at end of file diff --git a/lib/coffee_script/rewriter.rb b/lib/coffee_script/rewriter.rb index d3e30347..c841f582 100644 --- a/lib/coffee_script/rewriter.rb +++ b/lib/coffee_script/rewriter.rb @@ -151,6 +151,30 @@ module CoffeeScript end end + # Methods may be optionally called without parentheses, for simple cases. + # Insert the implicit parentheses here, so that the parser doesn't have to + # deal with them. + def add_implicit_parentheses + stack = [0] + scan_tokens do |prev, token, post, i| + stack.push(0) if token[0] == :INDENT + if token[0] == :OUTDENT + last = stack.pop + stack[-1] += last + end + if stack.last > 0 && (IMPLICIT_END.include?(token[0]) || post.nil?) + idx = token[0] == :OUTDENT ? i + 1 : i + stack.last.times { @tokens.insert(idx, [:CALL_END, Value.new(')', token[1].line)]) } + size, stack[-1] = stack[-1] + 1, 0 + next size + end + next 1 unless IMPLICIT_FUNC.include?(prev[0]) && IMPLICIT_CALL.include?(token[0]) + @tokens.insert(i, [:CALL_START, Value.new('(', token[1].line)]) + stack[-1] += 1 + next 2 + end + end + # Because our grammar is LALR(1), it can't handle some single-line # expressions that lack ending delimiters. Use the lexer to add the implicit # blocks, so it doesn't need to. @@ -183,30 +207,6 @@ module CoffeeScript end end - # Methods may be optionally called without parentheses, for simple cases. - # Insert the implicit parentheses here, so that the parser doesn't have to - # deal with them. - def add_implicit_parentheses - stack = [0] - scan_tokens do |prev, token, post, i| - stack.push(0) if token[0] == :INDENT - if token[0] == :OUTDENT - last = stack.pop - stack[-1] += last - end - if stack.last > 0 && (IMPLICIT_END.include?(token[0]) || post.nil?) - idx = token[0] == :OUTDENT ? i + 1 : i - stack.last.times { @tokens.insert(idx, [:CALL_END, Value.new(')', token[1].line)]) } - size, stack[-1] = stack[-1] + 1, 0 - next size - end - next 1 unless IMPLICIT_FUNC.include?(prev[0]) && IMPLICIT_CALL.include?(token[0]) - @tokens.insert(i, [:CALL_START, Value.new('(', token[1].line)]) - stack[-1] += 1 - next 2 - end - end - # Ensure that all listed pairs of tokens are correctly balanced throughout # the course of the token stream. def ensure_balance(*pairs) diff --git a/lib/coffee_script/runner.js b/lib/coffee_script/runner.js new file mode 100644 index 00000000..92052bf4 --- /dev/null +++ b/lib/coffee_script/runner.js @@ -0,0 +1,11 @@ +(function(){ + var coffee, paths; + // Quickie script to compile and run all the files given as arguments. + process.mixin(require('sys')); + coffee = require('./coffee-script'); + paths = process.ARGV; + paths = paths.slice(2, paths.length); + paths.length ? coffee.compile_files(paths, function(js) { + return eval(js); + }) : require('./repl'); +})(); \ No newline at end of file diff --git a/package.json b/package.json index aa678d87..cc6944b0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,6 @@ { "name": "coffee-script", "lib": "lib/coffee_script/narwhal", - "preload": ["narwhal"], "description": "Unfancy JavaScript", "keywords": ["javascript", "language"], "author": "Jeremy Ashkenas", diff --git a/src/coffee-script.coffee b/src/coffee-script.coffee new file mode 100644 index 00000000..0e1bd50b --- /dev/null +++ b/src/coffee-script.coffee @@ -0,0 +1,45 @@ +# Executes the `coffee` Ruby program to convert from CoffeeScript to JavaScript. +path: require('path') + +# The path to the CoffeeScript executable. +compiler: path.normalize(path.dirname(__filename) + '/../../bin/coffee') + + +# Compile a string over stdin, with global variables, for the REPL. +exports.compile: (code, callback) -> + js: '' + coffee: process.createChildProcess compiler, ['--eval', '--no-wrap', '--globals'] + + coffee.addListener 'output', (results) -> + js += results if results? + + coffee.addListener 'exit', -> + callback(js) + + coffee.write(code) + coffee.close() + + +# Compile a list of CoffeeScript files on disk. +exports.compile_files: (paths, callback) -> + js: '' + coffee: process.createChildProcess compiler, ['--print'].concat(paths) + + coffee.addListener 'output', (results) -> + js += results if results? + + # NB: we have to add a mutex to make sure it doesn't get called twice. + exit_ran: false + coffee.addListener 'exit', -> + return if exit_ran + exit_ran: true + callback(js) + + coffee.addListener 'error', (message) -> + return unless message + puts message + throw new Error "CoffeeScript compile error" + + + + diff --git a/src/lexer.coffee b/src/lexer.coffee new file mode 100644 index 00000000..42021a3b --- /dev/null +++ b/src/lexer.coffee @@ -0,0 +1,281 @@ +sys: require 'sys' +Rewriter: require('./rewriter').Rewriter + +# The lexer reads a stream of CoffeeScript and divvys it up into tagged +# tokens. A minor bit of the ambiguity in the grammar has been avoided by +# pushing some extra smarts into the Lexer. +exports.Lexer: lex: -> + +# Constants ============================================================ + +# The list of keywords passed verbatim to the parser. +KEYWORDS: [ + "if", "else", "then", "unless", + "true", "false", "yes", "no", "on", "off", + "and", "or", "is", "isnt", "not", + "new", "return", "arguments", + "try", "catch", "finally", "throw", + "break", "continue", + "for", "in", "of", "by", "where", "while", + "delete", "instanceof", "typeof", + "switch", "when", + "super", "extends" +] + +# Token matching regexes. +IDENTIFIER : /^([a-zA-Z$_](\w|\$)*)/ +NUMBER : /^(\b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?(e[+\-]?[0-9]+)?)))\b/i +STRING : /^(""|''|"([\s\S]*?)([^\\]|\\\\)"|'([\s\S]*?)([^\\]|\\\\)')/ +HEREDOC : /^("{6}|'{6}|"{3}\n?([\s\S]*?)\n?([ \t]*)"{3}|'{3}\n?([\s\S]*?)\n?([ \t]*)'{3})/ +JS : /^(``|`([\s\S]*?)([^\\]|\\\\)`)/ +OPERATOR : /^([+\*&|\/\-%=<>:!?]+)/ +WHITESPACE : /^([ \t]+)/ +COMMENT : /^(((\n?[ \t]*)?#.*$)+)/ +CODE : /^((-|=)>)/ +REGEX : /^(\/(.*?)([^\\]|\\\\)\/[imgy]{0,4})/ +MULTI_DENT : /^((\n([ \t]*))+)(\.)?/ +LAST_DENTS : /\n([ \t]*)/g +LAST_DENT : /\n([ \t]*)/ +ASSIGNMENT : /^(:|=)$/ + +# Token cleaning regexes. +JS_CLEANER : /(^`|`$)/g +MULTILINER : /\n/g +STRING_NEWLINES : /\n[ \t]*/g +COMMENT_CLEANER : /(^[ \t]*#|\n[ \t]*$)/mg +NO_NEWLINE : /^([+\*&|\/\-%=<>:!.\\][<>=&|]*|and|or|is|isnt|not|delete|typeof|instanceof)$/ +HEREDOC_INDENT : /^[ \t]+/g + +# Tokens which a regular expression will never immediately follow, but which +# a division operator might. +# See: http://www.mozilla.org/js/language/js20-2002-04/rationale/syntax.html#regular-expressions +NOT_REGEX: [ + 'IDENTIFIER', 'NUMBER', 'REGEX', 'STRING', + ')', '++', '--', ']', '}', + 'FALSE', 'NULL', 'TRUE' +] + +# Tokens which could legitimately be invoked or indexed. +CALLABLE: ['IDENTIFIER', 'SUPER', ')', ']', '}', 'STRING'] + +# Scan by attempting to match tokens one character at a time. Slow and steady. +lex::tokenize: (code) -> + this.code : code # Cleanup code by remove extra line breaks, TODO: chomp + this.i : 0 # Current character position we're parsing + this.line : 1 # The current line. + this.indent : 0 # The current indent level. + this.indents : [] # The stack of all indent levels we are currently within. + this.tokens : [] # Collection of all parsed tokens in the form [:TOKEN_TYPE, value] + this.spaced : null # The last token that has a space following it. + while this.i < this.code.length + this.chunk: this.code.slice(this.i) + this.extract_next_token() + # sys.puts "original stream: " + this.tokens if process.ENV['VERBOSE'] + this.close_indentation() + (new Rewriter()).rewrite this.tokens + +# At every position, run through this list of attempted matches, +# short-circuiting if any of them succeed. +lex::extract_next_token: -> + return if this.identifier_token() + return if this.number_token() + return if this.heredoc_token() + return if this.string_token() + return if this.js_token() + return if this.regex_token() + return if this.indent_token() + return if this.comment_token() + return if this.whitespace_token() + return this.literal_token() + +# Tokenizers ========================================================== + +# Matches identifying literals: variables, keywords, method names, etc. +lex::identifier_token: -> + return false unless id: this.match IDENTIFIER, 1 + # Keywords are special identifiers tagged with their own name, + # 'if' will result in an ['IF', "if"] token. + tag: if KEYWORDS.indexOf(id) >= 0 then id.toUpperCase() else 'IDENTIFIER' + tag: 'LEADING_WHEN' if tag is 'WHEN' and (this.tag() is 'OUTDENT' or this.tag() is 'INDENT') + this.tag(-1, 'PROTOTYPE_ACCESS') if tag is 'IDENTIFIER' and this.value() is '::' + if tag is 'IDENTIFIER' and this.value() is '.' and !(this.value(-2) is '.') + if this.tag(-2) is '?' + this.tag(-1, 'SOAK_ACCESS') + this.tokens.splice(-2, 1) + else + this.tag(-1, 'PROPERTY_ACCESS') + this.token(tag, id) + this.i += id.length + true + +# Matches numbers, including decimals, hex, and exponential notation. +lex::number_token: -> + return false unless number: this.match NUMBER, 1 + this.token 'NUMBER', number + this.i += number.length + true + +# Matches strings, including multi-line strings. +lex::string_token: -> + return false unless string: this.match STRING, 1 + escaped: string.replace STRING_NEWLINES, " \\\n" + this.token 'STRING', escaped + this.line += this.count string, "\n" + this.i += string.length + true + +# Matches heredocs, adjusting indentation to the correct level. +lex::heredoc_token: -> + return false unless match = this.chunk.match(HEREDOC) + doc: match[2] or match[4] + indent: doc.match(HEREDOC_INDENT).sort()[0] + doc: doc.replace(new RegExp("^" + indent, 'g'), '') + .replace(MULTILINER, "\\n") + .replace('"', '\\"') + this.token 'STRING', '"' + doc + '"' + this.line += this.count match[1], "\n" + this.i += match[1].length + true + +# Matches interpolated JavaScript. +lex::js_token: -> + return false unless script: this.match JS, 1 + this.token 'JS', script.replace(JS_CLEANER, '') + this.i += script.length + true + +# Matches regular expression literals. +lex::regex_token: -> + return false unless regex: this.match REGEX, 1 + return false if NOT_REGEX.indexOf(this.tag()) >= 0 + this.token 'REGEX', regex + this.i += regex.length + true + +# Matches and conumes comments. +lex::comment_token: -> + return false unless comment: this.match COMMENT, 1 + this.line += comment.match(MULTILINER).length + this.token 'COMMENT', comment.replace(COMMENT_CLEANER, '').split(MULTILINER) + this.token "\n", "\n" + this.i += comment.length + true + +# Record tokens for indentation differing from the previous line. +lex::indent_token: -> + return false unless indent: this.match MULTI_DENT, 1 + this.line += indent.match(MULTILINER).length + this.i += indent.length + next_character: this.chunk.match(MULTI_DENT)[4] + no_newlines: next_character is '.' or (this.value().match(NO_NEWLINE) and this.tokens[this.tokens.length - 2][0] isnt '.' and not this.value().match(CODE)) + return this.suppress_newlines(indent) if no_newlines + size: indent.match(LAST_DENTS).reverse()[0].match(LAST_DENT)[1].length + return this.newline_token(indent) if size is this.indent + if size > this.indent + diff: size - this.indent + this.token 'INDENT', diff + this.indents.push diff + else + this.outdent_token this.indent - size + this.indent: size + true + +# Record an oudent token or tokens, if we're moving back inwards past +# multiple recorded indents. +lex::outdent_token: (move_out) -> + while move_out > 0 and this.indents.length + last_indent: this.indents.pop() + this.token 'OUTDENT', last_indent + move_out -= last_indent + this.token "\n", "\n" + true + +# Matches and consumes non-meaningful whitespace. +lex::whitespace_token: -> + return false unless space: this.match WHITESPACE, 1 + this.spaced: this.value() + this.i += space.length + true + +# Multiple newlines get merged together. +# Use a trailing \ to escape newlines. +lex::newline_token: (newlines) -> + this.token "\n", "\n" unless this.value() is "\n" + true + +# Tokens to explicitly escape newlines are removed once their job is done. +lex::suppress_newlines: (newlines) -> + this.tokens.pop() if this.value() is "\\" + true + +# We treat all other single characters as a token. Eg.: ( ) , . ! +# Multi-character operators are also literal tokens, so that Racc can assign +# the proper order of operations. +lex::literal_token: -> + match: this.chunk.match(OPERATOR) + value: match and match[1] + this.tag_parameters() if value and value.match(CODE) + value ||= this.chunk.substr(0, 1) + tag: if value.match(ASSIGNMENT) then 'ASSIGN' else value + if this.value() isnt this.spaced and CALLABLE.indexOf(this.tag()) >= 0 + tag: 'CALL_START' if value is '(' + tag: 'INDEX_START' if value is '[' + this.token tag, value + this.i += value.length + true + +# Helpers ============================================================= + +# Add a token to the results, taking note of the line number. +lex::token: (tag, value) -> + this.tokens.push([tag, value]) + # this.tokens.push([tag, Value.new(value, @line)]) + +# Look at a tag in the current token stream. +lex::tag: (index, tag) -> + return unless tok: this.tokens[this.tokens.length - (index || 1)] + return tok[0]: tag if tag? + tok[0] + +# Look at a value in the current token stream. +lex::value: (index, val) -> + return unless tok: this.tokens[this.tokens.length - (index || 1)] + return tok[1]: val if val? + tok[1] + +# Count the occurences of a character in a string. +lex::count: (string, char) -> + num: 0 + pos: string.indexOf(char) + while pos isnt -1 + count += 1 + pos: string.indexOf(char, pos + 1) + count + +# Attempt to match a string against the current chunk, returning the indexed +# match. +lex::match: (regex, index) -> + return false unless m: this.chunk.match(regex) + if m then m[index] else false + +# A source of ambiguity in our grammar was parameter lists in function +# definitions (as opposed to argument lists in function calls). Tag +# parameter identifiers in order to avoid this. Also, parameter lists can +# make use of splats. +lex::tag_parameters: -> + return if this.tag() isnt ')' + i: 0 + while true + i += 1 + tok: this.tokens[this.tokens.length - i] + return if not tok + switch tok[0] + when 'IDENTIFIER' then tok[0]: 'PARAM' + when ')' then tok[0]: 'PARAM_END' + when '(' then return tok[0]: 'PARAM_START' + true + +# Close up all remaining open blocks. IF the first token is an indent, +# axe it. +lex::close_indentation: -> + this.outdent_token(this.indent) diff --git a/lib/coffee_script/narwhal/coffee-script.coffee b/src/narwhal/coffee-script.coffee similarity index 97% rename from lib/coffee_script/narwhal/coffee-script.coffee rename to src/narwhal/coffee-script.coffee index 7107fe51..0a9f1bbb 100644 --- a/lib/coffee_script/narwhal/coffee-script.coffee +++ b/src/narwhal/coffee-script.coffee @@ -14,6 +14,9 @@ checkForErrors: (coffeeProcess) -> system.stderr.print coffeeProcess.stderr.read() throw new Error "CoffeeScript compile error" +# Alias print to "puts", for Node.js compatibility: +puts: print + # Run a simple REPL, round-tripping to the CoffeeScript compiler for every # command. exports.run: (args) -> diff --git a/src/nodes.coffee b/src/nodes.coffee new file mode 100644 index 00000000..793ed44d --- /dev/null +++ b/src/nodes.coffee @@ -0,0 +1,30 @@ +exports.Node: -> this.values: arguments + +exports.Expressions : exports.Node +exports.LiteralNode : exports.Node +exports.ReturnNode : exports.Node +exports.CommentNode : exports.Node +exports.CallNode : exports.Node +exports.ExtendsNode : exports.Node +exports.ValueNode : exports.Node +exports.AccessorNode : exports.Node +exports.IndexNode : exports.Node +exports.RangeNode : exports.Node +exports.SliceNode : exports.Node +exports.AssignNode : exports.Node +exports.OpNode : exports.Node +exports.CodeNode : exports.Node +exports.SplatNode : exports.Node +exports.ObjectNode : exports.Node +exports.ArrayNode : exports.Node +exports.PushNode : exports.Node +exports.ClosureNode : exports.Node +exports.WhileNode : exports.Node +exports.ForNode : exports.Node +exports.TryNode : exports.Node +exports.ThrowNode : exports.Node +exports.ExistenceNode : exports.Node +exports.ParentheticalNode : exports.Node +exports.IfNode : exports.Node + + diff --git a/src/parser.coffee b/src/parser.coffee new file mode 100644 index 00000000..4fde8663 --- /dev/null +++ b/src/parser.coffee @@ -0,0 +1,528 @@ +Parser: require('jison').Parser + +# DSL =================================================================== + +# Detect functions: [ +unwrap: /function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/ + +# Quickie DSL for Jison access. +o: (pattern_string, func) -> + if func + func: if match: (func + "").match(unwrap) then match[1] else '(' + func + '())' + [pattern_string, '$$ = ' + func + ';'] + else + [pattern_string, '$$ = $1;'] + +# Precedence =========================================================== + +operators: [ + ["left", '?'] + ["right", 'NOT', '!', '!!', '~', '++', '--'] + ["left", '*', '/', '%'] + ["left", '+', '-'] + ["left", '<<', '>>', '>>>'] + ["left", '&', '|', '^'] + ["left", '<=', '<', '>', '>='] + ["right", '==', '!=', 'IS', 'ISNT'] + ["left", '&&', '||', 'AND', 'OR'] + ["right", '-=', '+=', '/=', '*=', '%='] + ["right", 'DELETE', 'INSTANCEOF', 'TYPEOF'] + ["left", '.'] + ["right", 'INDENT'] + ["left", 'OUTDENT'] + ["right", 'WHEN', 'LEADING_WHEN', 'IN', 'OF', 'BY'] + ["right", 'THROW', 'FOR', 'NEW', 'SUPER'] + ["left", 'EXTENDS'] + ["left", '||=', '&&=', '?='] + ["right", 'ASSIGN', 'RETURN'] + ["right", '->', '=>', 'UNLESS', 'IF', 'ELSE', 'WHILE'] +] + +# Grammar ============================================================== + +grammar: { + + # All parsing will end in this rule, being the trunk of the AST. + Root: [ + o "", -> new Expressions() + o "Terminator", -> new Expressions() + o "Expressions" + o "Block Terminator" + ] + + # Any list of expressions or method body, seperated by line breaks or semis. + Expressions: [ + o "Expression", -> Expressions.wrap([$1]) + o "Expressions Terminator Expression", -> $1.push($3) + o "Expressions Terminator" + ] + + # All types of expressions in our language. The basic unit of CoffeeScript + # is the expression. + Expression: [ + o "Value" + o "Call" + o "Code" + o "Operation" + o "Assign" + o "If" + o "Try" + o "Throw" + o "Return" + o "While" + o "For" + o "Switch" + o "Extends" + o "Splat" + o "Existence" + o "Comment" + ] + + # A block of expressions. Note that the Rewriter will convert some postfix + # forms into blocks for us, by altering the token stream. + Block: [ + o "INDENT Expressions OUTDENT", -> $2 + o "INDENT OUTDENT", -> new Expressions() + ] + + # Tokens that can terminate an expression. + Terminator: [ + o "\n" + o ";" + ] + + # All hard-coded values. These can be printed straight to JavaScript. + Literal: [ + o "NUMBER", -> new LiteralNode($1) + o "STRING", -> new LiteralNode($1) + o "JS", -> new LiteralNode($1) + o "REGEX", -> new LiteralNode($1) + o "BREAK", -> new LiteralNode($1) + o "CONTINUE", -> new LiteralNode($1) + o "ARGUMENTS", -> new LiteralNode($1) + o "TRUE", -> new LiteralNode(true) + o "FALSE", -> new LiteralNode(false) + o "YES", -> new LiteralNode(true) + o "NO", -> new LiteralNode(false) + o "ON", -> new LiteralNode(true) + o "OFF", -> new LiteralNode(false) + ] + + # Assignment to a variable (or index). + Assign: [ + o "Value ASSIGN Expression", -> new AssignNode($1, $3) + ] + + # Assignment within an object literal (can be quoted). + AssignObj: [ + o "IDENTIFIER ASSIGN Expression", -> new AssignNode(new ValueNode($1), $3, 'object') + o "STRING ASSIGN Expression", -> new AssignNode(new ValueNode(new LiteralNode($1)), $3, 'object') + o "Comment" + ] + + # A return statement. + Return: [ + o "RETURN Expression", -> new ReturnNode($2) + o "RETURN", -> new ReturnNode(new ValueNode(new LiteralNode('null'))) + ] + + # A comment. + Comment: [ + o "COMMENT", -> new CommentNode($1) + ] + + # Arithmetic and logical operators + # For Ruby's Operator precedence, see: [ + # https://www.cs.auckland.ac.nz/references/ruby/ProgrammingRuby/language.html + Operation: [ + o "! Expression", -> new OpNode($1, $2) + o "!! Expression", -> new OpNode($1, $2) + o "- Expression", -> new OpNode($1, $2) + o "+ Expression", -> new OpNode($1, $2) + o "NOT Expression", -> new OpNode($1, $2) + o "~ Expression", -> new OpNode($1, $2) + o "-- Expression", -> new OpNode($1, $2) + o "++ Expression", -> new OpNode($1, $2) + o "DELETE Expression", -> new OpNode($1, $2) + o "TYPEOF Expression", -> new OpNode($1, $2) + o "Expression --", -> new OpNode($2, $1, null, true) + o "Expression ++", -> new OpNode($2, $1, null, true) + + o "Expression * Expression", -> new OpNode($2, $1, $3) + o "Expression / Expression", -> new OpNode($2, $1, $3) + o "Expression % Expression", -> new OpNode($2, $1, $3) + + o "Expression + Expression", -> new OpNode($2, $1, $3) + o "Expression - Expression", -> new OpNode($2, $1, $3) + + o "Expression << Expression", -> new OpNode($2, $1, $3) + o "Expression >> Expression", -> new OpNode($2, $1, $3) + o "Expression >>> Expression", -> new OpNode($2, $1, $3) + + o "Expression & Expression", -> new OpNode($2, $1, $3) + o "Expression | Expression", -> new OpNode($2, $1, $3) + o "Expression ^ Expression", -> new OpNode($2, $1, $3) + + o "Expression <= Expression", -> new OpNode($2, $1, $3) + o "Expression < Expression", -> new OpNode($2, $1, $3) + o "Expression > Expression", -> new OpNode($2, $1, $3) + o "Expression >= Expression", -> new OpNode($2, $1, $3) + + o "Expression == Expression", -> new OpNode($2, $1, $3) + o "Expression != Expression", -> new OpNode($2, $1, $3) + o "Expression IS Expression", -> new OpNode($2, $1, $3) + o "Expression ISNT Expression", -> new OpNode($2, $1, $3) + + o "Expression && Expression", -> new OpNode($2, $1, $3) + o "Expression || Expression", -> new OpNode($2, $1, $3) + o "Expression AND Expression", -> new OpNode($2, $1, $3) + o "Expression OR Expression", -> new OpNode($2, $1, $3) + o "Expression ? Expression", -> new OpNode($2, $1, $3) + + o "Expression -= Expression", -> new OpNode($2, $1, $3) + o "Expression += Expression", -> new OpNode($2, $1, $3) + o "Expression /= Expression", -> new OpNode($2, $1, $3) + o "Expression *= Expression", -> new OpNode($2, $1, $3) + o "Expression %= Expression", -> new OpNode($2, $1, $3) + o "Expression ||= Expression", -> new OpNode($2, $1, $3) + o "Expression &&= Expression", -> new OpNode($2, $1, $3) + o "Expression ?= Expression", -> new OpNode($2, $1, $3) + + o "Expression INSTANCEOF Expression", -> new OpNode($2, $1, $3) + o "Expression IN Expression", -> new OpNode($2, $1, $3) + ] + + # Try abbreviated expressions to make the grammar build faster: + + # UnaryOp: [ + # o "!" + # o "!!" + # o "NOT" + # o "~" + # o "--" + # o "++" + # o "DELETE" + # o "TYPEOF" + # ] + # + # BinaryOp: [ + # o "*" + # o "/" + # o "%" + # o "+" + # o "-" + # o "<<" + # o ">>" + # o ">>>" + # o "&" + # o "|" + # o "^" + # o "<=" + # o "<" + # o ">" + # o ">=" + # o "==" + # o "!=" + # o "IS" + # o "ISNT" + # o "&&" + # o "||" + # o "AND" + # o "OR" + # o "?" + # o "-=" + # o "+=" + # o "/=" + # o "*=" + # o "%=" + # o "||=" + # o "&&=" + # o "?=" + # o "INSTANCEOF" + # o "IN" + # ] + # + # Operation: [ + # o "Expression BinaryOp Expression", -> new OpNode($2, $1, $3) + # o "UnaryOp Expression", -> new OpNode($1, $2) + # ] + + # The existence operator. + Existence: [ + o "Expression ?", -> new ExistenceNode($1) + ] + + # Function definition. + Code: [ + o "PARAM_START ParamList PARAM_END FuncGlyph Block", -> new CodeNode($2, $5, $4) + o "FuncGlyph Block", -> new CodeNode([], $2, $1) + ] + + # The symbols to signify functions, and bound functions. + FuncGlyph: [ + o "->", -> 'func' + o "=>", -> 'boundfunc' + ] + + # The parameters to a function definition. + ParamList: [ + o "Param", -> [$1] + o "ParamList , Param", -> $1.push($3) + ] + + # A Parameter (or ParamSplat) in a function definition. + Param: [ + o "PARAM" + o "PARAM . . .", -> new SplatNode($1) + ] + + # A regular splat. + Splat: [ + o "Expression . . .", -> new SplatNode($1) + ] + + # Expressions that can be treated as values. + Value: [ + o "IDENTIFIER", -> new ValueNode($1) + o "Literal", -> new ValueNode($1) + o "Array", -> new ValueNode($1) + o "Object", -> new ValueNode($1) + o "Parenthetical", -> new ValueNode($1) + o "Range", -> new ValueNode($1) + o "Value Accessor", -> $1.push($2) + o "Invocation Accessor", -> new ValueNode($1, [$2]) + ] + + # Accessing into an object or array, through dot or index notation. + Accessor: [ + o "PROPERTY_ACCESS IDENTIFIER", -> new AccessorNode($2) + o "PROTOTYPE_ACCESS IDENTIFIER", -> new AccessorNode($2, 'prototype') + o "SOAK_ACCESS IDENTIFIER", -> new AccessorNode($2, 'soak') + o "Index" + o "Slice", -> new SliceNode($1) + ] + + # Indexing into an object or array. + Index: [ + o "INDEX_START Expression INDEX_END", -> new IndexNode($2) + ] + + # An object literal. + Object: [ + o "{ AssignList }", -> new ObjectNode($2) + ] + + # Assignment within an object literal (comma or newline separated). + AssignList: [ + o "", -> [] + o "AssignObj", -> [$1] + o "AssignList , AssignObj", -> $1.push $3 + o "AssignList Terminator AssignObj", -> $1.push $3 + o "AssignList , Terminator AssignObj", -> $1.push $4 + o "INDENT AssignList OUTDENT", -> $2 + ] + + # All flavors of function call (instantiation, super, and regular). + Call: [ + o "Invocation", -> $1 + o "NEW Invocation", -> $2.new_instance() + o "Super", -> $1 + ] + + # Extending an object's prototype. + Extends: [ + o "Value EXTENDS Value", -> new ExtendsNode($1, $3) + ] + + # A generic function invocation. + Invocation: [ + o "Value Arguments", -> new CallNode($1, $2) + o "Invocation Arguments", -> new CallNode($1, $2) + ] + + # The list of arguments to a function invocation. + Arguments: [ + o "CALL_START ArgList CALL_END", -> $2 + ] + + # Calling super. + Super: [ + o "SUPER CALL_START ArgList CALL_END", -> new CallNode('super', $3) + ] + + # The range literal. + Range: [ + o "[ Expression . . Expression ]", -> new RangeNode($2, $5) + o "[ Expression . . . Expression ]", -> new RangeNode($2, $6, true) + ] + + # The slice literal. + Slice: [ + o "INDEX_START Expression . . Expression INDEX_END", -> new RangeNode($2, $5) + o "INDEX_START Expression . . . Expression INDEX_END", -> new RangeNode($2, $6, true) + ] + + # The array literal. + Array: [ + o "[ ArgList ]", -> new ArrayNode($2) + ] + + # A list of arguments to a method call, or as the contents of an array. + ArgList: [ + o "", -> [] + o "Expression", -> val + o "INDENT Expression", -> [$2] + o "ArgList , Expression", -> $1.push $3 + o "ArgList Terminator Expression", -> $1.push $3 + o "ArgList , Terminator Expression", -> $1.push $4 + o "ArgList , INDENT Expression", -> $1.push $4 + o "ArgList OUTDENT", -> $1 + ] + + # Just simple, comma-separated, required arguments (no fancy syntax). + SimpleArgs: [ + o "Expression", -> $1 + o "SimpleArgs , Expression", -> + ([$1].push($3)).reduce (a, b) -> a.concat(b) + ] + + # Try/catch/finally exception handling blocks. + Try: [ + o "TRY Block Catch", -> new TryNode($2, $3[0], $3[1]) + o "TRY Block FINALLY Block", -> new TryNode($2, nil, nil, $4) + o "TRY Block Catch FINALLY Block", -> new TryNode($2, $3[0], $3[1], $5) + ] + + # A catch clause. + Catch: [ + o "CATCH IDENTIFIER Block", -> [$2, $3] + ] + + # Throw an exception. + Throw: [ + o "THROW Expression", -> new ThrowNode($2) + ] + + # Parenthetical expressions. + Parenthetical: [ + o "( Expression )", -> new ParentheticalNode($2) + ] + + # The while loop. (there is no do..while). + While: [ + o "WHILE Expression Block", -> new WhileNode($2, $3) + o "WHILE Expression", -> new WhileNode($2, nil) + o "Expression WHILE Expression", -> new WhileNode($3, Expressions.wrap($1)) + ] + + # Array comprehensions, including guard and current index. + # Looks a little confusing, check nodes.rb for the arguments to ForNode. + For: [ + o "Expression FOR ForVariables ForSource", -> new ForNode($1, $4, $3[0], $3[1]) + o "FOR ForVariables ForSource Block", -> new ForNode($4, $3, $2[0], $2[1]) + ] + + # An array comprehension has variables for the current element and index. + ForVariables: [ + o "IDENTIFIER", -> [$1] + o "IDENTIFIER , IDENTIFIER", -> [$1, $3] + ] + + # The source of the array comprehension can optionally be filtered. + ForSource: [ + o "IN Expression", -> {source: $2} + o "OF Expression", -> {source: $2, object: true} + o "ForSource WHEN Expression", -> $1.filter: $3; $1 + o "ForSource BY Expression", -> $1.step: $3; $1 + ] + + # Switch/When blocks. + Switch: [ + o "SWITCH Expression INDENT Whens OUTDENT", -> $4.rewrite_condition($2) + o "SWITCH Expression INDENT Whens ELSE Block OUTDENT", -> $4.rewrite_condition($2).add_else($6) + ] + + # The inner list of whens. + Whens: [ + o "When", -> $1 + o "Whens When", -> $1.push $2 + ] + + # An individual when. + When: [ + o "LEADING_WHEN SimpleArgs Block", -> new IfNode($2, $3, nil, {statement: true}) + o "LEADING_WHEN SimpleArgs Block Terminator", -> new IfNode($2, $3, nil, {statement: true}) + o "Comment Terminator When", -> $3.add_comment($1) + ] + + # The most basic form of "if". + IfBlock: [ + o "IF Expression Block", -> new IfNode($2, $3) + ] + + # An elsif portion of an if-else block. + ElsIf: [ + o "ELSE IfBlock", -> $2.force_statement() + ] + + # Multiple elsifs can be chained together. + ElsIfs: [ + o "ElsIf", -> $1 + o "ElsIfs ElsIf", -> $1.add_else($2) + ] + + # Terminating else bodies are strictly optional. + ElseBody: [ + o "", -> null + o "ELSE Block", -> $2 + ] + + # All the alternatives for ending an if-else block. + IfEnd: [ + o "ElseBody", -> $1 + o "ElsIfs ElseBody", -> $1.add_else($2) + ] + + # The full complement of if blocks, including postfix one-liner ifs and unlesses. + If: [ + o "IfBlock IfEnd", -> $1.add_else($2) + o "Expression IF Expression", -> new IfNode($3, Expressions.wrap($1), nil, {statement: true}) + o "Expression UNLESS Expression", -> new IfNode($3, Expressions.wrap($1), nil, {statement: true, invert: true}) + ] + +} + +# Helpers ============================================================== + +# Make the Jison parser. +bnf: {} +tokens: [] +for name, non_terminal of grammar + bnf[name]: for option in non_terminal + for part in option[0].split(" ") + if !grammar[part] + tokens.push(part) + if name == "Root" + option[1] = "return " + option[1] + option +tokens: tokens.join(" ") +parser: new Parser({tokens: tokens, bnf: bnf, operators: operators}, {debug: false}) + +# Thin wrapper around the real lexer +parser.lexer: { + lex: -> + token: this.tokens[this.pos] or [""] + this.pos += 1 + # this.yylineno: token and token[1] and token[1][1] + this.yytext: token[1] + token[0] + setInput: (tokens) -> + this.tokens = tokens + this.pos = 0 + upcomingInput: -> "" + showPosition: -> this.pos +} + +exports.Parser: -> + +exports.Parser::parse: (tokens) -> parser.parse(tokens) \ No newline at end of file diff --git a/src/repl.coffee b/src/repl.coffee new file mode 100644 index 00000000..1ab9c70b --- /dev/null +++ b/src/repl.coffee @@ -0,0 +1,26 @@ +# A CoffeeScript port/version of the Node.js REPL. + +# Required modules. +coffee: require './coffee-script' +process.mixin require 'sys' + +# Shortcut variables. +prompt: 'coffee> ' +quit: -> process.stdio.close() + +# The main REPL function. Called everytime a line of code is entered. +readline: (code) -> coffee.compile code, run + +# Attempt to evaluate the command. If there's an exception, print it. +run: (js) -> + try + val: eval(js) + p val if val isnt undefined + catch err + puts err.stack or err.toString() + print prompt + +# Start up the REPL. +process.stdio.open() +process.stdio.addListener 'data', readline +print prompt \ No newline at end of file diff --git a/src/rewriter.coffee b/src/rewriter.coffee new file mode 100644 index 00000000..79a74db8 --- /dev/null +++ b/src/rewriter.coffee @@ -0,0 +1,244 @@ +# In order to keep the grammar simple, the stream of tokens that the Lexer +# emits is rewritten by the Rewriter, smoothing out ambiguities, mis-nested +# indentation, and single-line flavors of expressions. +exports.Rewriter: re: -> + +# Tokens that must be balanced. +BALANCED_PAIRS: [['(', ')'], ['[', ']'], ['{', '}'], ['INDENT', 'OUTDENT'], + ['PARAM_START', 'PARAM_END'], ['CALL_START', 'CALL_END'], ['INDEX_START', 'INDEX_END']] + +# Tokens that signal the start of a balanced pair. +EXPRESSION_START: pair[0] for pair in BALANCED_PAIRS + +# Tokens that signal the end of a balanced pair. +EXPRESSION_TAIL: pair[1] for pair in BALANCED_PAIRS + +# Tokens that indicate the close of a clause of an expression. +EXPRESSION_CLOSE: ['CATCH', 'WHEN', 'ELSE', 'FINALLY'].concat(EXPRESSION_TAIL) + +# Tokens pairs that, in immediate succession, indicate an implicit call. +IMPLICIT_FUNC: ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END'] +IMPLICIT_END: ['IF', 'UNLESS', 'FOR', 'WHILE', "\n", 'OUTDENT'] +IMPLICIT_CALL: ['IDENTIFIER', 'NUMBER', 'STRING', 'JS', 'REGEX', 'NEW', 'PARAM_START', + 'TRY', 'DELETE', 'TYPEOF', 'SWITCH', 'ARGUMENTS', + 'TRUE', 'FALSE', 'YES', 'NO', 'ON', 'OFF', '!', '!!', 'NOT', + '->', '=>', '[', '(', '{'] + +# The inverse mappings of token pairs we're trying to fix up. +INVERSES: {} +for pair in BALANCED_PAIRS + INVERSES[pair[0]]: pair[1] + INVERSES[pair[1]]: pair[0] + +# Single-line flavors of block expressions that have unclosed endings. +# The grammar can't disambiguate them, so we insert the implicit indentation. +SINGLE_LINERS: ['ELSE', "->", "=>", 'TRY', 'FINALLY', 'THEN'] +SINGLE_CLOSERS: ["\n", 'CATCH', 'FINALLY', 'ELSE', 'OUTDENT', 'LEADING_WHEN', 'PARAM_START'] + +# Rewrite the token stream in multiple passes, one logical filter at +# a time. This could certainly be changed into a single pass through the +# stream, with a big ol' efficient switch, but it's much nicer like this. +re::rewrite: (tokens) -> + this.tokens: tokens + this.adjust_comments() + this.remove_leading_newlines() + this.remove_mid_expression_newlines() + this.move_commas_outside_outdents() + this.close_open_calls_and_indexes() + this.add_implicit_parentheses() + this.add_implicit_indentation() + this.ensure_balance(BALANCED_PAIRS) + this.rewrite_closing_parens() + this.tokens + +# Rewrite the token stream, looking one token ahead and behind. +# Allow the return value of the block to tell us how many tokens to move +# forwards (or backwards) in the stream, to make sure we don't miss anything +# as the stream changes length under our feet. +re::scan_tokens: (yield) -> + i: 0 + while true + break unless this.tokens[i] + move: yield(this.tokens[i - 1], this.tokens[i], this.tokens[i + 1], i) + i += move + true + +# Massage newlines and indentations so that comments don't have to be +# correctly indented, or appear on their own line. +re::adjust_comments: -> + this.scan_tokens (prev, token, post, i) => + return 1 unless token[0] is 'COMMENT' + before: this.tokens[i - 2] + after: this.tokens[i + 2] + if before and after and + ((before[0] is 'INDENT' and after[0] is 'OUTDENT') or + (before[0] is 'OUTDENT' and after[0] is 'INDENT')) and + before[1] is after[1] + this.tokens.splice(i + 2, 1) + this.tokens.splice(i - 2, 1) + return 0 + else if prev[0] is "\n" and after[0] is 'INDENT' + this.tokens.splice(i + 2, 1) + this.tokens[i - 1]: after + return 1 + else if prev[0] isnt "\n" and prev[0] isnt 'INDENT' and prev[0] isnt 'OUTDENT' + this.tokens.splice(i, 0, ["\n", "\n"]) + return 2 + else + return 1 + +# Leading newlines would introduce an ambiguity in the grammar, so we +# dispatch them here. +re::remove_leading_newlines: -> + this.tokens.shift() if this.tokens[0][0] is "\n" + +# Some blocks occur in the middle of expressions -- when we're expecting +# this, remove their trailing newlines. +re::remove_mid_expression_newlines: -> + this.scan_tokens (prev, token, post, i) => + return 1 unless post and EXPRESSION_CLOSE.indexOf(post[0]) >= 0 and token[0] is "\n" + this.tokens.splice(i, 1) + return 0 + +# Make sure that we don't accidentally break trailing commas, which need +# to go on the outside of expression closers. +re::move_commas_outside_outdents: -> + this.scan_tokens (prev, token, post, i) => + this.tokens.splice(i, 1, token) if token[0] is 'OUTDENT' and prev[0] is ',' + return 1 + +# We've tagged the opening parenthesis of a method call, and the opening +# bracket of an indexing operation. Match them with their close. +re::close_open_calls_and_indexes: -> + parens: [0] + brackets: [0] + this.scan_tokens (prev, token, post, i) => + switch token[0] + when 'CALL_START' then parens.push(0) + when 'INDEX_START' then brackets.push(0) + when '(' then parens[parens.length - 1] += 1 + when '[' then brackets[brackets.length - 1] += 1 + when ')' + if parens[parens.length - 1] is 0 + parens.pop() + token[0]: 'CALL_END' + else + parens[parens.length - 1] -= 1 + when ']' + if brackets[brackets.length - 1] == 0 + brackets.pop() + token[0]: 'INDEX_END' + else + brackets[brackets.length - 1] -= 1 + return 1 + +# Methods may be optionally called without parentheses, for simple cases. +# Insert the implicit parentheses here, so that the parser doesn't have to +# deal with them. +re::add_implicit_parentheses: -> + stack: [0] + this.scan_tokens (prev, token, post, i) => + stack.push(0) if token[0] is 'INDENT' + if token[0] is 'OUTDENT' + last: stack.pop() + stack[stack.length - 1] += last + if stack[stack.length - 1] > 0 and (IMPLICIT_END.indexOf(token[0]) >= 0 or !post?) + idx: if token[0] is 'OUTDENT' then i + 1 else i + for tmp in [0...stack[stack.length - 1]] + this.tokens.splice(idx, 0, ['CALL_END', ')']) + size: stack[stack.length - 1] + 1 + stack[stack.length - 1]: 0 + return size + return 1 unless prev and IMPLICIT_FUNC.indexOf(prev[0]) >= 0 and IMPLICIT_CALL.indexOf(token[0]) >= 0 + this.tokens.splice(i, 0, ['CALL_START', '(']) + stack[stack.length - 1] += 1 + return 2 + +# Because our grammar is LALR(1), it can't handle some single-line +# expressions that lack ending delimiters. Use the lexer to add the implicit +# blocks, so it doesn't need to. +# ')' can close a single-line block, but we need to make sure it's balanced. +re::add_implicit_indentation: -> + this.scan_tokens (prev, token, post, i) => + return 1 unless SINGLE_LINERS.indexOf(token[0]) >= 0 and post[0] isnt 'INDENT' and + not (token[0] is 'ELSE' and post[0] is 'IF') + starter: token[0] + this.tokens.splice(i + 1, 0, ['INDENT', 2]) + idx: i + 1 + parens: 0 + while true + idx += 1 + tok: this.tokens[idx] + if (not tok or SINGLE_CLOSERS.indexOf(tok[0]) >= 0 or + (tok[0] is ')' && parens is 0)) and + not (starter is 'ELSE' and tok[0] is 'ELSE') + insertion: if this.tokens[idx - 1][0] is "," then idx - 1 else idx + this.tokens.splice(insertion, 0, ['OUTDENT', 2]) + break + parens += 1 if tok[0] is '(' + parens -= 1 if tok[0] is ')' + return 1 unless token[0] is 'THEN' + this.tokens.splice(i, 1) + return 0 + +# Ensure that all listed pairs of tokens are correctly balanced throughout +# the course of the token stream. +re::ensure_balance: (pairs) -> + levels: {} + this.scan_tokens (prev, token, post, i) => + for pair in pairs + [open, close]: pair + levels[open] ||= 0 + levels[open] += 1 if token[0] is open + levels[open] -= 1 if token[0] is close + throw "too many " + token[1] if levels[open] < 0 + return 1 + unclosed: key for key, value of levels when value > 0 + throw "unclosed " + unclosed[0] if unclosed.length + +# We'd like to support syntax like this: +# el.click((event) -> +# el.hide()) +# In order to accomplish this, move outdents that follow closing parens +# inwards, safely. The steps to accomplish this are: +# +# 1. Check that all paired tokens are balanced and in order. +# 2. Rewrite the stream with a stack: if you see an '(' or INDENT, add it +# to the stack. If you see an ')' or OUTDENT, pop the stack and replace +# it with the inverse of what we've just popped. +# 3. Keep track of "debt" for tokens that we fake, to make sure we end +# up balanced in the end. +# +re::rewrite_closing_parens: -> + stack: [] + debt: {} + (debt[key]: 0) for key, val of INVERSES + this.scan_tokens (prev, token, post, i) => + tag: token[0] + inv: INVERSES[token[0]] + # Push openers onto the stack. + if EXPRESSION_START.indexOf(tag) >= 0 + stack.push(token) + return 1 + # The end of an expression, check stack and debt for a pair. + else if EXPRESSION_TAIL.indexOf(tag) >= 0 + # If the tag is already in our debt, swallow it. + if debt[inv] > 0 + debt[inv] -= 1 + this.tokens.splice(i, 1) + return 0 + else + # Pop the stack of open delimiters. + match: stack.pop() + mtag: match[0] + # Continue onwards if it's the expected tag. + if tag is INVERSES[mtag] + return 1 + else + # Unexpected close, insert correct close, adding to the debt. + debt[mtag] += 1 + val: if mtag is 'INDENT' then match[1] else INVERSES[mtag] + this.tokens.splice(i, 0, [INVERSES[mtag], val]) + return 1 + else + return 1 diff --git a/src/runner.coffee b/src/runner.coffee new file mode 100644 index 00000000..4cb8e95f --- /dev/null +++ b/src/runner.coffee @@ -0,0 +1,12 @@ +# Quickie script to compile and run all the files given as arguments. + +process.mixin require 'sys' +coffee: require './coffee-script' + +paths: process.ARGV +paths: paths[2...paths.length] + +if paths.length + coffee.compile_files paths, (js) -> eval(js) +else + require './repl' diff --git a/test/fixtures/execution/test_arguments.coffee b/test/fixtures/execution/test_arguments.coffee index de23c445..8ee45de0 100644 --- a/test/fixtures/execution/test_arguments.coffee +++ b/test/fixtures/execution/test_arguments.coffee @@ -4,12 +4,12 @@ area: (x, y, x1, y1) -> x: y: 10 x1: y1: 20 -print area(x, y, x1, y1) is 100 +puts area(x, y, x1, y1) is 100 -print(area(x, y, +puts(area(x, y, x1, y1) is 100) -print(area( +puts(area( x y x1 @@ -19,7 +19,7 @@ print(area( # Arguments are turned into arrays. curried: -> - print area.apply(this, arguments.concat(20, 20)) is 100 + puts area.apply(this, arguments.concat(20, 20)) is 100 curried 10, 10 @@ -29,9 +29,9 @@ func: -> arguments: 25 arguments -print func(100) is 25 +puts func(100) is 25 # Arguments can be accessed as a property. this.arguments: 10 -print @arguments is 10 +puts @arguments is 10 diff --git a/test/fixtures/execution/test_array_comprehension.coffee b/test/fixtures/execution/test_array_comprehension.coffee index 08350a93..33fb0ddf 100644 --- a/test/fixtures/execution/test_array_comprehension.coffee +++ b/test/fixtures/execution/test_array_comprehension.coffee @@ -1,15 +1,15 @@ nums: n * n for n in [1, 2, 3] when n % 2 isnt 0 results: n * 2 for n in nums -print results.join(',') is '2,18' +puts results.join(',') is '2,18' obj: {one: 1, two: 2, three: 3} names: prop + '!' for prop of obj odds: prop + '!' for prop, value of obj when value % 2 isnt 0 -print names.join(' ') is "one! two! three!" -print odds.join(' ') is "one! three!" +puts names.join(' ') is "one! two! three!" +puts odds.join(' ') is "one! three!" evens: for num in [1, 2, 3, 4, 5, 6] when num % 2 is 0 @@ -17,12 +17,12 @@ evens: for num in [1, 2, 3, 4, 5, 6] when num % 2 is 0 num -= 2 num * -1 -print evens.join(', ') is '4, 6, 8' +puts evens.join(', ') is '4, 6, 8' # Make sure that the "in" operator still works. -print 2 in evens +puts 2 in evens # When functions are being defined within the body of a comprehension, make @@ -37,12 +37,12 @@ for method in methods obj[name]: -> "I'm " + name -print obj.one() is "I'm one" -print obj.two() is "I'm two" -print obj.three() is "I'm three" +puts obj.one() is "I'm one" +puts obj.two() is "I'm two" +puts obj.three() is "I'm three" # Steps should work for array comprehensions. array: [0..10] -print num % 2 is 0 for num in array by 2 +puts num % 2 is 0 for num in array by 2 diff --git a/test/fixtures/execution/test_assignment.coffee b/test/fixtures/execution/test_assignment.coffee index 3fd42dd8..ebe72da7 100644 --- a/test/fixtures/execution/test_assignment.coffee +++ b/test/fixtures/execution/test_assignment.coffee @@ -7,7 +7,7 @@ catch error result2: try nonexistent * missing catch error then true -print result is true and result2 is true +puts result is true and result2 is true # Assign to conditional. @@ -16,8 +16,8 @@ get_x: -> 10 if x: get_x() then 100 -print x is 10 +puts x is 10 x: if get_x() then 100 -print x is 100 \ No newline at end of file +puts x is 100 \ No newline at end of file diff --git a/test/fixtures/execution/test_blocks.coffee b/test/fixtures/execution/test_blocks.coffee index 2efd8aa8..98097dcc 100644 --- a/test/fixtures/execution/test_blocks.coffee +++ b/test/fixtures/execution/test_blocks.coffee @@ -1,4 +1,4 @@ results: [1, 2, 3].map (x) -> x * x -print results.join(' ') is '1 4 9' \ No newline at end of file +puts results.join(' ') is '1 4 9' \ No newline at end of file diff --git a/test/fixtures/execution/test_calling_super.coffee b/test/fixtures/execution/test_calling_super.coffee index 8a14350b..a72fcdd6 100644 --- a/test/fixtures/execution/test_calling_super.coffee +++ b/test/fixtures/execution/test_calling_super.coffee @@ -20,7 +20,7 @@ ThirdChild::func: (string) -> result: (new ThirdChild()).func 'four' -print result is 'zero/one/two/three/four' +puts result is 'zero/one/two/three/four' TopClass: (arg) -> @@ -35,4 +35,4 @@ SubClass: -> SuperClass extends TopClass SubClass extends SuperClass -print((new SubClass()).prop is 'top-super-sub') \ No newline at end of file +puts((new SubClass()).prop is 'top-super-sub') \ No newline at end of file diff --git a/test/fixtures/execution/test_chained_calls.coffee b/test/fixtures/execution/test_chained_calls.coffee index 8f0b7043..eaad589a 100644 --- a/test/fixtures/execution/test_chained_calls.coffee +++ b/test/fixtures/execution/test_chained_calls.coffee @@ -3,7 +3,7 @@ identity_wrap: (x) -> result: identity_wrap(identity_wrap(true))()() -print result +puts result str: 'god' @@ -14,7 +14,7 @@ result: str. reverse(). reverse() -print result.join('') is 'dog' +puts result.join('') is 'dog' result: str .split('') @@ -22,4 +22,4 @@ result: str .reverse() .reverse() -print result.join('') is 'dog' \ No newline at end of file +puts result.join('') is 'dog' \ No newline at end of file diff --git a/test/fixtures/execution/test_destructuring_assignment.coffee b/test/fixtures/execution/test_destructuring_assignment.coffee index 3aa454c3..da5ab0fc 100644 --- a/test/fixtures/execution/test_destructuring_assignment.coffee +++ b/test/fixtures/execution/test_destructuring_assignment.coffee @@ -3,26 +3,26 @@ b: -2 [a, b]: [b, a] -print a is -2 -print b is -1 +puts a is -2 +puts b is -1 arr: [1, 2, 3] [a, b, c]: arr -print a is 1 -print b is 2 -print c is 3 +puts a is 1 +puts b is 2 +puts c is 3 obj: {x: 10, y: 20, z: 30} {x: a, y: b, z: c}: obj -print a is 10 -print b is 20 -print c is 30 +puts a is 10 +puts b is 20 +puts c is 30 person: { @@ -42,8 +42,8 @@ person: { {name: a, family: {brother: {addresses: [one, {city: b}]}}}: person -print a is "Bob" -print b is "Moquasset NY, 10021" +puts a is "Bob" +puts b is "Moquasset NY, 10021" test: { @@ -59,4 +59,4 @@ test: { {person: {address: [ignore, addr...]}}: test -print addr.join(', ') is "Street 101, Apt 101, City 101" \ No newline at end of file +puts addr.join(', ') is "Street 101, Apt 101, City 101" \ No newline at end of file diff --git a/test/fixtures/execution/test_everything.coffee b/test/fixtures/execution/test_everything.coffee index c6b54b95..c52ae0a1 100644 --- a/test/fixtures/execution/test_everything.coffee +++ b/test/fixtures/execution/test_everything.coffee @@ -26,4 +26,4 @@ func: -> c.single: c.list[1..1][0] -print func() is '-' +puts func() is '-' diff --git a/test/fixtures/execution/test_existence.coffee b/test/fixtures/execution/test_existence.coffee index 2d4c5593..a87693af 100644 --- a/test/fixtures/execution/test_existence.coffee +++ b/test/fixtures/execution/test_existence.coffee @@ -1,8 +1,8 @@ -print(if my_special_variable? then false else true) +puts(if my_special_variable? then false else true) my_special_variable: false -print(if my_special_variable? then true else false) +puts(if my_special_variable? then true else false) # Existential assignment. @@ -12,7 +12,7 @@ a: null a ?= 10 b ?= 10 -print a is 10 and b is 10 +puts a is 10 and b is 10 # The existential operator. @@ -20,7 +20,7 @@ print a is 10 and b is 10 z: null x: z ? "EX" -print z is null and x is "EX" +puts z is null and x is "EX" # Only evaluate once. @@ -30,7 +30,7 @@ get_next_node: -> throw "up" if counter counter++ -print(if get_next_node()? then true else false) +puts(if get_next_node()? then true else false) # Existence chains, soaking up undefined properties: @@ -39,19 +39,19 @@ obj: { prop: "hello" } -print obj?.prop is "hello" +puts obj?.prop is "hello" -print obj.prop?.length is 5 +puts obj.prop?.length is 5 -print obj?.prop?.non?.existent?.property is undefined +puts obj?.prop?.non?.existent?.property is undefined # Soaks and caches method calls as well. arr: ["--", "----"] -print arr.pop()?.length is 4 -print arr.pop()?.length is 2 -print arr.pop()?.length is undefined -print arr[0]?.length is undefined -print arr.pop()?.length?.non?.existent()?.property is undefined +puts arr.pop()?.length is 4 +puts arr.pop()?.length is 2 +puts arr.pop()?.length is undefined +puts arr[0]?.length is undefined +puts arr.pop()?.length?.non?.existent()?.property is undefined diff --git a/test/fixtures/execution/test_expressions.coffee b/test/fixtures/execution/test_expressions.coffee index 9686d1a4..eee44179 100644 --- a/test/fixtures/execution/test_expressions.coffee +++ b/test/fixtures/execution/test_expressions.coffee @@ -9,7 +9,7 @@ findit: (items) -> for item in items return item if item is "bacon" -print findit(items) is "bacon" +puts findit(items) is "bacon" # When when a closure wrapper is generated for expression conversion, make sure @@ -26,5 +26,5 @@ obj: { this.num } -print obj.num is obj.func() -print obj.num is obj.result \ No newline at end of file +puts obj.num is obj.func() +puts obj.num is obj.result \ No newline at end of file diff --git a/test/fixtures/execution/test_fancy_if_statement.coffee b/test/fixtures/execution/test_fancy_if_statement.coffee index f71dd511..978c9def 100644 --- a/test/fixtures/execution/test_fancy_if_statement.coffee +++ b/test/fixtures/execution/test_fancy_if_statement.coffee @@ -7,10 +7,10 @@ result: if a if d true -print result +puts result first: if false then false else second: if false then false else true -print first -print second \ No newline at end of file +puts first +puts second \ No newline at end of file diff --git a/test/fixtures/execution/test_functions.coffee b/test/fixtures/execution/test_functions.coffee index 0aa4939b..9c63f39a 100644 --- a/test/fixtures/execution/test_functions.coffee +++ b/test/fixtures/execution/test_functions.coffee @@ -2,11 +2,11 @@ x: 1 y: {} y.x: -> 3 -print x is 1 -print typeof(y.x) is 'function' -print y.x instanceof Function -print y.x() is 3 -print y.x.name is 'x' +puts x is 1 +puts typeof(y.x) is 'function' +puts y.x instanceof Function +puts y.x() is 3 +puts y.x.name is 'x' # The empty function should not cause a syntax error. @@ -17,10 +17,10 @@ obj: { name: "Fred" bound: -> - (=> print(this.name is "Fred"))() + (=> puts(this.name is "Fred"))() unbound: -> - (-> print(!this.name?))() + (-> puts(!this.name?))() } obj.unbound() @@ -44,18 +44,18 @@ Math: { FastAdd: memoize (a, b) -> a + b } -print Math.Add(5, 5) is 10 -print Math.AnonymousAdd(10, 10) is 20 -print Math.FastAdd(20, 20) is 40 +puts Math.Add(5, 5) is 10 +puts Math.AnonymousAdd(10, 10) is 20 +puts Math.FastAdd(20, 20) is 40 # Parens are optional on simple function calls. -print 100 > 1 if 1 > 0 -print true unless false -print true for i in [1..3] +puts 100 > 1 if 1 > 0 +puts true unless false +puts true for i in [1..3] -print_func: (f) -> print(f()) -print_func -> true +puts_func: (f) -> puts(f()) +puts_func -> true # Optional parens can be used in a nested fashion. call: (func) -> func() @@ -64,7 +64,7 @@ result: call -> inner: call -> Math.Add(5, 5) -print result is 10 +puts result is 10 # And even with strange things like this: @@ -72,8 +72,8 @@ print result is 10 funcs: [(x) -> x, (x) -> x * x] result: funcs[1] 5 -print result is 25 +puts result is 25 result: ("hello".slice) 3 -print result is 'lo' \ No newline at end of file +puts result is 'lo' \ No newline at end of file diff --git a/test/fixtures/execution/test_funky_comments.coffee b/test/fixtures/execution/test_funky_comments.coffee index 9fbc030e..6a0940f1 100644 --- a/test/fixtures/execution/test_funky_comments.coffee +++ b/test/fixtures/execution/test_funky_comments.coffee @@ -18,4 +18,4 @@ switch 'string' code() # comment -print func() +puts func() diff --git a/test/fixtures/execution/test_heredocs.coffee b/test/fixtures/execution/test_heredocs.coffee index bb0becfd..5304fb26 100644 --- a/test/fixtures/execution/test_heredocs.coffee +++ b/test/fixtures/execution/test_heredocs.coffee @@ -3,7 +3,7 @@ a: """ on two lines """ -print a is "basic heredoc\non two lines" +puts a is "basic heredoc\non two lines" a: ''' @@ -12,12 +12,12 @@ a: ''' c ''' -print a is "a\n \"b\nc" +puts a is "a\n \"b\nc" a: '''one-liner''' -print a is 'one-liner' +puts a is 'one-liner' a: """ @@ -25,7 +25,7 @@ a: """ here """ -print a is "out\nhere" +puts a is "out\nhere" a: ''' @@ -34,7 +34,7 @@ a: ''' c ''' -print a is " a\n b\nc" +puts a is " a\n b\nc" a: ''' a @@ -43,4 +43,4 @@ a b c ''' -print a is "a\n\n\nb c" +puts a is "a\n\n\nb c" diff --git a/test/fixtures/execution/test_lexical_scope.coffee b/test/fixtures/execution/test_lexical_scope.coffee index 769b5096..5693ecd6 100644 --- a/test/fixtures/execution/test_lexical_scope.coffee +++ b/test/fixtures/execution/test_lexical_scope.coffee @@ -1,10 +1,10 @@ num: 1 + 2 + (a: 3) -print num is 6 +puts num is 6 result: if true false other: "result" -print result is "result" and other is "result" \ No newline at end of file +puts result is "result" and other is "result" \ No newline at end of file diff --git a/test/fixtures/execution/test_literals.coffee b/test/fixtures/execution/test_literals.coffee index cc5393ae..c38f63d8 100644 --- a/test/fixtures/execution/test_literals.coffee +++ b/test/fixtures/execution/test_literals.coffee @@ -1,40 +1,40 @@ a: [(x) -> x, (x) -> x * x] -print a.length is 2 +puts a.length is 2 regex: /match/i words: "I think there is a match in here." -print !!words.match(regex) +puts !!words.match(regex) neg: (3 -4) -print neg is -1 +puts neg is -1 func: -> return if true -print func() is null +puts func() is null str: "\\" reg: /\\/ -print reg(str) and str is '\\' +puts reg(str) and str is '\\' i: 10 while i -= 1 -print i is 0 +puts i is 0 money$: 'dollars' -print money$ is 'dollars' +puts money$ is 'dollars' bob: { @@ -45,4 +45,4 @@ bob: { @greet "Hello" } -print bob.hello() is "Hello Bob" +puts bob.hello() is "Hello Bob" diff --git a/test/fixtures/execution/test_nested_comprehensions.coffee b/test/fixtures/execution/test_nested_comprehensions.coffee index 8f50c490..77ed44b6 100644 --- a/test/fixtures/execution/test_nested_comprehensions.coffee +++ b/test/fixtures/execution/test_nested_comprehensions.coffee @@ -6,6 +6,6 @@ multi_liner: single_liner: [x, y] for y in [3..5] for x in [3..5] -print multi_liner.length is single_liner.length -print 5 is multi_liner[2][2][1] -print 5 is single_liner[2][2][1] +puts multi_liner.length is single_liner.length +puts 5 is multi_liner[2][2][1] +puts 5 is single_liner[2][2][1] diff --git a/test/fixtures/execution/test_newline_escaping.coffee b/test/fixtures/execution/test_newline_escaping.coffee index 9e91f452..d5c30899 100644 --- a/test/fixtures/execution/test_newline_escaping.coffee +++ b/test/fixtures/execution/test_newline_escaping.coffee @@ -3,4 +3,4 @@ six: 2 + 3 -print six is 6 \ No newline at end of file +puts six is 6 \ No newline at end of file diff --git a/test/fixtures/execution/test_operations.coffee b/test/fixtures/execution/test_operations.coffee index 86332804..86699ca2 100644 --- a/test/fixtures/execution/test_operations.coffee +++ b/test/fixtures/execution/test_operations.coffee @@ -1,12 +1,12 @@ # CoffeeScript's operations should be chainable, like Python's. -print 500 > 50 > 5 > -5 +puts 500 > 50 > 5 > -5 -print true is not false is true is not false +puts true is not false is true is not false -print 10 < 20 > 10 +puts 10 < 20 > 10 -print 50 > 10 > 5 is parseInt('5', 10) +puts 50 > 10 > 5 is parseInt('5', 10) # Make sure that each argument is only evaluated once, even if used @@ -15,4 +15,4 @@ print 50 > 10 > 5 is parseInt('5', 10) i: 0 func: -> i++ -print 1 > func() < 1 +puts 1 > func() < 1 diff --git a/test/fixtures/execution/test_range_comprehension.coffee b/test/fixtures/execution/test_range_comprehension.coffee index 947c27d2..67d41e19 100644 --- a/test/fixtures/execution/test_range_comprehension.coffee +++ b/test/fixtures/execution/test_range_comprehension.coffee @@ -5,16 +5,16 @@ negs: negs[0..2] result: nums.concat(negs).join(', ') -print result is '3, 6, 9, -20, -19, -18' +puts result is '3, 6, 9, -20, -19, -18' # Ensure that ranges are safe. This used to infinite loop: j = 5 result: for j in [j..(j+3)] j -print result.join(' ') is '5 6 7 8' +puts result.join(' ') is '5 6 7 8' # With range comprehensions, you can loop in steps. results: x for x in [0..25] by 5 -print results.join(' ') is '0 5 10 15 20 25' \ No newline at end of file +puts results.join(' ') is '0 5 10 15 20 25' \ No newline at end of file diff --git a/test/fixtures/execution/test_ranges_and_slices.coffee b/test/fixtures/execution/test_ranges_and_slices.coffee index a6a0bf18..3a174555 100644 --- a/test/fixtures/execution/test_ranges_and_slices.coffee +++ b/test/fixtures/execution/test_ranges_and_slices.coffee @@ -5,7 +5,12 @@ b: array[2...4] result: a.concat(b).join(' ') -print result is "7 8 9 2 3" +puts result is "7 8 9 2 3" + countdown: [10..1].join(' ') -print countdown is "10 9 8 7 6 5 4 3 2 1" \ No newline at end of file +puts countdown is "10 9 8 7 6 5 4 3 2 1" + + +array: [(1+5)..1+9] +puts array.join(' ') is "6 7 8 9 10" \ No newline at end of file diff --git a/test/fixtures/execution/test_splats.coffee b/test/fixtures/execution/test_splats.coffee index 18083d89..b50c2fb2 100644 --- a/test/fixtures/execution/test_splats.coffee +++ b/test/fixtures/execution/test_splats.coffee @@ -3,7 +3,7 @@ func: (first, second, rest...) -> result: func 1, 2, 3, 4, 5 -print result is "3 4 5" +puts result is "3 4 5" gold: silver: bronze: the_field: null @@ -29,7 +29,7 @@ contenders: [ medalists "Mighty Mouse", contenders... -print gold is "Mighty Mouse" -print silver is "Michael Phelps" -print bronze is "Liu Xiang" -print the_field.length is 8 \ No newline at end of file +puts gold is "Mighty Mouse" +puts silver is "Michael Phelps" +puts bronze is "Liu Xiang" +puts the_field.length is 8 \ No newline at end of file diff --git a/test/fixtures/execution/test_splices.coffee b/test/fixtures/execution/test_splices.coffee index e9baf877..56e6787d 100644 --- a/test/fixtures/execution/test_splices.coffee +++ b/test/fixtures/execution/test_splices.coffee @@ -2,4 +2,4 @@ array: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] array[5..10]: [0, 0, 0] -print array.join(' ') is '0 1 2 3 4 0 0 0' \ No newline at end of file +puts array.join(' ') is '0 1 2 3 4 0 0 0' \ No newline at end of file diff --git a/test/fixtures/execution/test_switch.coffee b/test/fixtures/execution/test_switch.coffee index 3911f043..b97fa011 100644 --- a/test/fixtures/execution/test_switch.coffee +++ b/test/fixtures/execution/test_switch.coffee @@ -14,7 +14,7 @@ result: switch num when 11 then false else false -print result +puts result func: (num) -> switch num @@ -24,7 +24,7 @@ func: (num) -> false else false -print func(2) -print func(6) -print !func(3) -print !func(8) +puts func(2) +puts func(6) +puts !func(3) +puts !func(8) diff --git a/test/fixtures/execution/test_while.coffee b/test/fixtures/execution/test_while.coffee index c065fe04..e44a061f 100644 --- a/test/fixtures/execution/test_while.coffee +++ b/test/fixtures/execution/test_while.coffee @@ -1,17 +1,17 @@ i: 100 while i -= 1 -print i is 0 +puts i is 0 i: 5 list: while i -= 1 i * 2 -print list.join(' ') is "8 6 4 2" +puts list.join(' ') is "8 6 4 2" i: 5 list: (i * 3 while i -= 1) -print list.join(' ') is "12 9 6 3" \ No newline at end of file +puts list.join(' ') is "12 9 6 3" \ No newline at end of file diff --git a/test/fixtures/generation/statements_as_expressions.coffee b/test/fixtures/generation/statements_as_expressions.coffee index 56baa374..6f6f8616 100644 --- a/test/fixtures/generation/statements_as_expressions.coffee +++ b/test/fixtures/generation/statements_as_expressions.coffee @@ -3,14 +3,14 @@ result: while sunny? go_outside() -print(3 + try +puts(3 + try nonexistent.no_way catch error - print(error) + puts(error) 3 ) func: (x) -> return throw x -print(x * x for x in [1..100]) \ No newline at end of file +puts(x * x for x in [1..100]) \ No newline at end of file diff --git a/test/unit/test_execution.rb b/test/unit/test_execution.rb index 8eea7479..732acb96 100644 --- a/test/unit/test_execution.rb +++ b/test/unit/test_execution.rb @@ -19,6 +19,13 @@ class ExecutionTest < Test::Unit::TestCase end end + # Test all of the code examples under Narwhal as well. + def test_execution_with_narwhal + (`bin/coffee -r --narwhal #{SOURCES.join(' ')}`).split("\n").each do |line| + assert line == "true" + end + end + def test_lintless_tests no_warnings `bin/coffee -l test/fixtures/*/*.coffee` end