diff --git a/Cakefile b/Cakefile index c9192470..fee765c2 100644 --- a/Cakefile +++ b/Cakefile @@ -3,7 +3,7 @@ coffee: require 'coffee-script' # Run a CoffeeScript through our node/coffee interpreter. run: (args) -> - proc: process.createChildProcess 'bin/node_coffee', args + proc: process.createChildProcess 'bin/coffee', args proc.addListener 'error', (err) -> if err then puts err diff --git a/README b/README index 23b910c1..e6e5ca0f 100644 --- a/README +++ b/README @@ -23,7 +23,7 @@ CoffeeScript is a little language that compiles into JavaScript. Install the compiler: - gem install coffee-script + ... to be determined ... Compile a script: coffee /path/to/script.coffee @@ -38,14 +38,4 @@ The source repository: git://github.com/jashkenas/coffee-script.git - - Warning: A new version of the compiler, written entirely in CoffeeScript, - is in the works. Check out /src for the details. To try it out, use - bin/node_coffee. To have CoffeeScript recompile itself, run: - - build compiler - - To rebuild the Jison parser (takes about 30 seconds), run: - - build grammar - \ No newline at end of file + diff --git a/bin/coffee b/bin/coffee index 51184c42..023e00b8 100755 --- a/bin/coffee +++ b/bin/coffee @@ -1,5 +1,7 @@ -#!/usr/bin/env ruby +#!/usr/bin/env node -- -require "#{File.dirname(__FILE__)}/../lib/coffee_script/command_line.rb" +process.mixin(require('sys')); -CoffeeScript::CommandLine.new \ No newline at end of file +require.paths.unshift('./lib/coffee_script'); + +require('command_line').run(); diff --git a/bin/node_coffee b/bin/node_coffee deleted file mode 100755 index 023e00b8..00000000 --- a/bin/node_coffee +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node -- - -process.mixin(require('sys')); - -require.paths.unshift('./lib/coffee_script'); - -require('command_line').run(); diff --git a/coffee-script.gemspec b/coffee-script.gemspec deleted file mode 100644 index f9b279cb..00000000 --- a/coffee-script.gemspec +++ /dev/null @@ -1,27 +0,0 @@ -Gem::Specification.new do |s| - s.name = 'coffee-script' - s.version = '0.3.2' # Keep version in sync with coffee-script.rb - s.date = '2010-2-8' - - s.homepage = "http://jashkenas.github.com/coffee-script/" - s.summary = "The CoffeeScript Compiler" - s.description = <<-EOS - CoffeeScript is a little language that compiles into JavaScript. Think - of it as JavaScript's less ostentatious kid brother -- the same genes, - roughly the same height, but a different sense of style. Apart from a - handful of bonus goodies, statements in CoffeeScript correspond - one-to-one with their equivalent in JavaScript, it's just another - way of saying it. - EOS - - s.authors = ['Jeremy Ashkenas'] - s.email = 'jashkenas@gmail.com' - s.rubyforge_project = 'coffee-script' - s.has_rdoc = false - - s.require_paths = ['lib'] - s.executables = ['coffee'] - - s.files = Dir['bin/*', 'examples/*', 'extras/**/*', 'lib/**/*', - 'coffee-script.gemspec', 'LICENSE', 'README', 'package.json'] -end \ No newline at end of file diff --git a/extras/EXTRAS b/extras/EXTRAS index d555e3fb..3f2c0f8a 100644 --- a/extras/EXTRAS +++ b/extras/EXTRAS @@ -1,8 +1,8 @@ This folder includes rough cuts of CoffeeScript syntax highlighters for TextMate and Vim. Improvements to their lexing ability are always welcome. -To install the TextMate bundle, run `bin/coffee --install-bundle`, or drop it -into "~/Library/Application Support/TextMate/Bundles". +To install the TextMate bundle, drop it into: + ~/Library/Application Support/TextMate/Bundles To install the Vim highlighter, copy "coffee.vim" into the "syntax" directory of your vim72, and enable it in either of the following two ways: diff --git a/lib/coffee-script.rb b/lib/coffee-script.rb deleted file mode 100644 index 9c0b2af6..00000000 --- a/lib/coffee-script.rb +++ /dev/null @@ -1,21 +0,0 @@ -$LOAD_PATH.unshift(File.dirname(__FILE__)) -require "coffee_script/lexer" -require "coffee_script/parser" -require "coffee_script/nodes" -require "coffee_script/value" -require "coffee_script/scope" -require "coffee_script/rewriter" -require "coffee_script/parse_error" - -# Namespace for all CoffeeScript internal classes. -module CoffeeScript - - VERSION = '0.3.2' # Keep in sync with the gemspec. - - # Compile a script (String or IO) to JavaScript. - def self.compile(script, options={}) - script = script.read if script.respond_to?(:read) - Parser.new.parse(script).compile(options) - end - -end diff --git a/lib/coffee_script/command_line.rb b/lib/coffee_script/command_line.rb deleted file mode 100644 index 4db0ff39..00000000 --- a/lib/coffee_script/command_line.rb +++ /dev/null @@ -1,235 +0,0 @@ -require 'optparse' -require 'fileutils' -require 'open3' -begin - require File.expand_path(File.dirname(__FILE__) + '/../coffee-script') -rescue LoadError => e - puts(e.message) - puts("use \"rake build:parser\" to regenerate parser.rb") - exit(1) -end - -module CoffeeScript - - # The CommandLine handles all of the functionality of the `coffee` - # utility. - class CommandLine - - BANNER = <<-EOS -coffee compiles CoffeeScript source files into JavaScript. - -Usage: - coffee path/to/script.coffee - EOS - - # Seconds to pause between checks for changed source files. - WATCH_INTERVAL = 0.5 - - # Path to the root of the CoffeeScript install. - ROOT = File.expand_path(File.dirname(__FILE__) + '/../..') - - # 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 - @mtimes = {} - parse_options - return launch_repl if @options[:interactive] - return eval_scriptlet if @options[:eval] - check_sources - return run_scripts if @options[:run] - @sources.each {|source| compile_javascript(source) } - watch_coffee_scripts if @options[:watch] - end - - # The "--help" usage message. - def usage - puts "\n#{@option_parser}\n" - exit - end - - - private - - # Compiles (or partially compiles) the source CoffeeScript file, returning - # the desired JS, tokens, or lint results. - def compile_javascript(source) - script = File.read(source) - return tokens(script) if @options[:tokens] - js = compile(script, source) - return unless js - return puts(js) if @options[:print] - return lint(js) if @options[:lint] - File.open(path_for(source), 'w+') {|f| f.write(js) } - end - - # Spins up a watcher thread to keep track of the modification times of the - # source files, recompiling them whenever they're saved. - def watch_coffee_scripts - watch_thread = Thread.start do - loop do - @sources.each do |source| - mtime = File.stat(source).mtime - @mtimes[source] ||= mtime - if mtime > @mtimes[source] - @mtimes[source] = mtime - compile_javascript(source) - end - end - sleep WATCH_INTERVAL - end - end - Signal.trap("INT") { watch_thread.kill } - watch_thread.join - end - - # Ensure that all of the source files exist. - def check_sources - usage if @sources.empty? - missing = @sources.detect {|s| !File.exists?(s) } - if missing - STDERR.puts("File not found: '#{missing}'") - exit(1) - end - end - - # Pipe compiled JS through JSLint (requires a working 'jsl' command). - def lint(js) - stdin, stdout, stderr = Open3.popen3('jsl -nologo -stdin') - stdin.write(js) - stdin.close - puts stdout.read.tr("\n", '') - errs = stderr.read.chomp - puts errs unless errs.empty? - stdout.close and stderr.close - end - - # Eval a little piece of CoffeeScript directly from the command line. - def eval_scriptlet - script = STDIN.tty? ? @sources.join(' ') : STDIN.read - return tokens(script) if @options[:tokens] - js = compile(script) - return lint(js) if @options[:lint] - puts js - end - - # Use Node.js or Narwhal to run an interactive CoffeeScript session. - def launch_repl - exec "#{RUNNERS[@options[:runner]]}" - rescue Errno::ENOENT - puts "Error: #{@options[:runner]} must be installed to use the interactive REPL." - exit(1) - end - - # Use Node.js or Narwhal to compile and execute CoffeeScripts. - def run_scripts - sources = @sources.join(' ') - exec "#{RUNNERS[@options[:runner]]} #{sources}" - rescue Errno::ENOENT - puts "Error: #{@options[:runner]} must be installed in order to execute scripts." - exit(1) - end - - # Print the tokens that the lexer generates from a source script. - def tokens(script) - puts Lexer.new.tokenize(script).inspect - end - - # Compile a single source file to JavaScript. - def compile(script, source='error') - begin - options = {} - options[:no_wrap] = true if @options[:no_wrap] - options[:globals] = true if @options[:globals] - CoffeeScript.compile(script, options) - rescue CoffeeScript::ParseError => e - STDERR.puts "#{source}: #{e.message}" - exit(1) unless @options[:watch] - nil - end - end - - # Write out JavaScript alongside CoffeeScript unless an output directory - # is specified. - def path_for(source) - filename = File.basename(source, File.extname(source)) + '.js' - dir = @options[:output] || File.dirname(source) - File.join(dir, filename) - end - - # Install the CoffeeScript TextMate bundle to ~/Library. - def install_bundle - bundle_dir = File.expand_path('~/Library/Application Support/TextMate/Bundles/') - FileUtils.cp_r("#{ROOT}/extras/CoffeeScript.tmbundle", bundle_dir) - end - - # Use OptionParser for all the options. - def parse_options - @options = {:runner => :node} - @option_parser = OptionParser.new do |opts| - opts.on('-i', '--interactive', 'run an interactive CoffeeScript REPL') do |i| - @options[:interactive] = true - end - 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| - @options[:output] = d - FileUtils.mkdir_p(d) unless File.exists?(d) - end - opts.on('-w', '--watch', 'watch scripts for changes, and recompile') do |w| - @options[:watch] = true - end - opts.on('-p', '--print', 'print the compiled JavaScript to stdout') do |d| - @options[:print] = true - end - opts.on('-l', '--lint', 'pipe the compiled JavaScript through JSLint') do |l| - @options[:lint] = true - end - opts.on('-e', '--eval', 'compile a cli scriptlet or read from stdin') do |e| - @options[:eval] = true - end - opts.on('-t', '--tokens', 'print the tokens that the lexer produces') do |t| - @options[:tokens] = true - end - opts.on('-v', '--verbose', 'print at every step of code generation') do |v| - ENV['VERBOSE'] = 'true' - end - opts.on('-n', '--no-wrap', 'raw output, no function safety wrapper') do |n| - @options[:no_wrap] = true - end - opts.on('-g', '--globals', 'attach all top-level variables 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 - end - opts.on_tail('--version', 'display CoffeeScript version') do - puts "CoffeeScript version #{CoffeeScript::VERSION}" - exit - end - opts.on_tail('-h', '--help', 'display this help message') do - usage - end - end - @option_parser.banner = BANNER - begin - @option_parser.parse!(ARGV) - rescue OptionParser::InvalidOption => e - puts e.message - exit(1) - end - @sources = ARGV - end - - end - -end diff --git a/lib/coffee_script/grammar.y b/lib/coffee_script/grammar.y deleted file mode 100644 index 4be7ea85..00000000 --- a/lib/coffee_script/grammar.y +++ /dev/null @@ -1,483 +0,0 @@ -class Parser - -# Declare terminal tokens produced by the lexer. -token IF ELSE UNLESS -token NUMBER STRING REGEX -token TRUE FALSE YES NO ON OFF -token IDENTIFIER PROPERTY_ACCESS PROTOTYPE_ACCESS SOAK_ACCESS -token CODE PARAM_START PARAM PARAM_END NEW RETURN -token CALL_START CALL_END INDEX_START INDEX_END -token TRY CATCH FINALLY THROW -token BREAK CONTINUE -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 -token INDENT OUTDENT - -# Declare order of operations. -prechigh - left '?' - nonassoc UMINUS UPLUS NOT '!' '!!' '~' '++' '--' - left '*' '/' '%' '.' - left '+' '-' - left '<<' '>>' '>>>' '&' '|' '^' - left '<=' '<' '>' '>=' - right DELETE INSTANCEOF TYPEOF - right '==' '!=' IS ISNT - left '&&' '||' AND OR - right '-=' '+=' '/=' '*=' '%=' '||=' '&&=' '?=' - right INDENT - left OUTDENT - right WHEN LEADING_WHEN IN OF BY - right THROW FOR NEW SUPER - left EXTENDS - right ASSIGN RETURN - right '->' '=>' UNLESS IF ELSE WHILE -preclow - -rule - - # All parsing will end in this rule, being the trunk of the AST. - Root: - /* nothing */ { result = Expressions.new } - | Terminator { result = Expressions.new } - | Expressions { result = val[0] } - | Block Terminator { result = val[0] } - ; - - # Any list of expressions or method body, seperated by line breaks or semis. - Expressions: - Expression { result = Expressions.wrap(val) } - | Expressions Terminator Expression { result = val[0] << val[2] } - | Expressions Terminator { result = val[0] } - ; - - # All types of expressions in our language. The basic unit of CoffeeScript - # is the expression. - Expression: - Value - | Call - | Code - | Operation - | Assign - | If - | Try - | Throw - | Return - | While - | For - | Switch - | Extends - | Splat - | Existence - | Comment - ; - - # A block of expressions. Note that the Rewriter will convert some postfix - # forms into blocks for us, by altering the token stream. - Block: - INDENT Expressions OUTDENT { result = val[1] } - | INDENT OUTDENT { result = Expressions.new } - ; - - # Tokens that can terminate an expression. - Terminator: - "\n" - | ";" - ; - - # All hard-coded values. These can be printed straight to JavaScript. - Literal: - NUMBER { result = LiteralNode.new(val[0]) } - | STRING { result = LiteralNode.new(val[0]) } - | JS { result = LiteralNode.new(val[0]) } - | REGEX { result = LiteralNode.new(val[0]) } - | BREAK { result = LiteralNode.new(val[0]) } - | CONTINUE { result = LiteralNode.new(val[0]) } - | TRUE { result = LiteralNode.new(Value.new(true)) } - | FALSE { result = LiteralNode.new(Value.new(false)) } - | YES { result = LiteralNode.new(Value.new(true)) } - | NO { result = LiteralNode.new(Value.new(false)) } - | ON { result = LiteralNode.new(Value.new(true)) } - | OFF { result = LiteralNode.new(Value.new(false)) } - ; - - # Assignment to a variable (or index). - Assign: - Value ASSIGN Expression { result = AssignNode.new(val[0], val[2]) } - ; - - # Assignment within an object literal (can be quoted). - AssignObj: - IDENTIFIER ASSIGN Expression { result = AssignNode.new(ValueNode.new(val[0]), val[2], :object) } - | STRING ASSIGN Expression { result = AssignNode.new(ValueNode.new(LiteralNode.new(val[0])), val[2], :object) } - | NUMBER ASSIGN Expression { result = AssignNode.new(ValueNode.new(LiteralNode.new(val[0])), val[2], :object) } - | Comment { result = val[0] } - ; - - # A return statement. - Return: - RETURN Expression { result = ReturnNode.new(val[1]) } - | RETURN { result = ReturnNode.new(ValueNode.new(Value.new('null'))) } - ; - - # A comment. - Comment: - COMMENT { result = CommentNode.new(val[0]) } - ; - - # Arithmetic and logical operators - # For Ruby's Operator precedence, see: - # https://www.cs.auckland.ac.nz/references/ruby/ProgrammingRuby/language.html - Operation: - '!' Expression { result = OpNode.new(val[0], val[1]) } - | '!!' Expression { result = OpNode.new(val[0], val[1]) } - | '-' Expression = UMINUS { result = OpNode.new(val[0], val[1]) } - | '+' Expression = UPLUS { result = OpNode.new(val[0], val[1]) } - | NOT Expression { result = OpNode.new(val[0], val[1]) } - | '~' Expression { result = OpNode.new(val[0], val[1]) } - | '--' Expression { result = OpNode.new(val[0], val[1]) } - | '++' Expression { result = OpNode.new(val[0], val[1]) } - | DELETE Expression { result = OpNode.new(val[0], val[1]) } - | TYPEOF Expression { result = OpNode.new(val[0], val[1]) } - | Expression '--' { result = OpNode.new(val[1], val[0], nil, true) } - | Expression '++' { result = OpNode.new(val[1], val[0], nil, true) } - - | Expression '*' Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression '/' Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression '%' Expression { result = OpNode.new(val[1], val[0], val[2]) } - - | Expression '+' Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression '-' Expression { result = OpNode.new(val[1], val[0], val[2]) } - - | Expression '<<' Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression '>>' Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression '>>>' Expression { result = OpNode.new(val[1], val[0], val[2]) } - - | Expression '&' Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression '|' Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression '^' Expression { result = OpNode.new(val[1], val[0], val[2]) } - - | Expression '<=' Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression '<' Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression '>' Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression '>=' Expression { result = OpNode.new(val[1], val[0], val[2]) } - - | Expression '==' Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression '!=' Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression IS Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression ISNT Expression { result = OpNode.new(val[1], val[0], val[2]) } - - | Expression '&&' Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression '||' Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression AND Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression OR Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression '?' Expression { result = OpNode.new(val[1], val[0], val[2]) } - - | Expression '-=' Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression '+=' Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression '/=' Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression '*=' Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression '%=' Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression '||=' Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression '&&=' Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression '?=' Expression { result = OpNode.new(val[1], val[0], val[2]) } - - | Expression INSTANCEOF Expression { result = OpNode.new(val[1], val[0], val[2]) } - | Expression IN Expression { result = OpNode.new(val[1], val[0], val[2]) } - ; - - # The existence operator. - Existence: - Expression '?' { result = ExistenceNode.new(val[0]) } - ; - - # Function definition. - Code: - PARAM_START ParamList PARAM_END - FuncGlyph Block { result = CodeNode.new(val[1], val[4], val[3]) } - | FuncGlyph Block { result = CodeNode.new([], val[1], val[0]) } - ; - - # The symbols to signify functions, and bound functions. - FuncGlyph: - '->' { result = :func } - | '=>' { result = :boundfunc } - ; - - # The parameters to a function definition. - ParamList: - Param { result = val } - | ParamList "," Param { result = val[0] << val[2] } - ; - - # A Parameter (or ParamSplat) in a function definition. - Param: - PARAM - | PARAM "." "." "." { result = SplatNode.new(val[0]) } - ; - - # A regular splat. - Splat: - Expression "." "." "." { result = SplatNode.new(val[0]) } - ; - - # Expressions that can be treated as values. - Value: - IDENTIFIER { result = ValueNode.new(val[0]) } - | Literal { result = ValueNode.new(val[0]) } - | Array { result = ValueNode.new(val[0]) } - | Object { result = ValueNode.new(val[0]) } - | Parenthetical { result = ValueNode.new(val[0]) } - | Range { result = ValueNode.new(val[0]) } - | This { result = ValueNode.new(val[0]) } - | Value Accessor { result = val[0] << val[1] } - | Invocation Accessor { result = ValueNode.new(val[0], [val[1]]) } - ; - - # Accessing into an object or array, through dot or index notation. - Accessor: - PROPERTY_ACCESS IDENTIFIER { result = AccessorNode.new(val[1]) } - | PROTOTYPE_ACCESS IDENTIFIER { result = AccessorNode.new(val[1], :prototype) } - | SOAK_ACCESS IDENTIFIER { result = AccessorNode.new(val[1], :soak) } - | Index { result = val[0] } - | Slice { result = SliceNode.new(val[0]) } - ; - - # Indexing into an object or array. - Index: - INDEX_START Expression INDEX_END { result = IndexNode.new(val[1]) } - ; - - # An object literal. - Object: - "{" AssignList "}" { result = ObjectNode.new(val[1]) } - ; - - # Assignment within an object literal (comma or newline separated). - AssignList: - /* nothing */ { result = [] } - | AssignObj { result = val } - | AssignList "," AssignObj { result = val[0] << val[2] } - | AssignList Terminator AssignObj { result = val[0] << val[2] } - | AssignList "," - Terminator AssignObj { result = val[0] << val[3] } - | INDENT AssignList OUTDENT { result = val[1] } - ; - - # All flavors of function call (instantiation, super, and regular). - Call: - Invocation { result = val[0] } - | NEW Invocation { result = val[1].new_instance } - | Super { result = val[0] } - ; - - # Extending an object's prototype. - Extends: - Value EXTENDS Value { result = ExtendsNode.new(val[0], val[2]) } - ; - - # A generic function invocation. - Invocation: - Value Arguments { result = CallNode.new(val[0], val[1]) } - | Invocation Arguments { result = CallNode.new(val[0], val[1]) } - ; - - # The list of arguments to a function invocation. - Arguments: - CALL_START ArgList CALL_END { result = val[1] } - ; - - # Calling super. - Super: - SUPER CALL_START ArgList CALL_END { result = CallNode.new(Value.new('super'), val[2]) } - ; - - # This references, either naked or to a property. - This: - '@' { result = ThisNode.new } - | '@' IDENTIFIER { result = ThisNode.new(val[1]) } - ; - - # The range literal. - Range: - "[" Expression - "." "." Expression "]" { result = RangeNode.new(val[1], val[4]) } - | "[" Expression - "." "." "." Expression "]" { result = RangeNode.new(val[1], val[5], true) } - ; - - # The slice literal. - Slice: - INDEX_START Expression "." "." - Expression INDEX_END { result = RangeNode.new(val[1], val[4]) } - | INDEX_START Expression "." "." "." - Expression INDEX_END { result = RangeNode.new(val[1], val[5], true) } - ; - - # The array literal. - Array: - "[" ArgList "]" { result = ArrayNode.new(val[1]) } - ; - - # A list of arguments to a method call, or as the contents of an array. - ArgList: - /* nothing */ { result = [] } - | Expression { result = val } - | INDENT Expression { result = [val[1]] } - | ArgList "," Expression { result = val[0] << val[2] } - | ArgList Terminator Expression { result = val[0] << val[2] } - | ArgList "," Terminator Expression { result = val[0] << val[3] } - | ArgList "," INDENT Expression { result = val[0] << val[3] } - | ArgList OUTDENT { result = val[0] } - ; - - # Just simple, comma-separated, required arguments (no fancy syntax). - SimpleArgs: - Expression { result = val[0] } - | SimpleArgs "," Expression { result = ([val[0]] << val[2]).flatten } - ; - - # Try/catch/finally exception handling blocks. - Try: - TRY Block Catch { result = TryNode.new(val[1], val[2][0], val[2][1]) } - | TRY Block FINALLY Block { result = TryNode.new(val[1], nil, nil, val[3]) } - | TRY Block Catch - FINALLY Block { result = TryNode.new(val[1], val[2][0], val[2][1], val[4]) } - ; - - # A catch clause. - Catch: - CATCH IDENTIFIER Block { result = [val[1], val[2]] } - ; - - # Throw an exception. - Throw: - THROW Expression { result = ThrowNode.new(val[1]) } - ; - - # Parenthetical expressions. - Parenthetical: - "(" Expression ")" { result = ParentheticalNode.new(val[1], val[0].line) } - ; - - # The while loop. (there is no do..while). - While: - WHILE Expression Block { result = WhileNode.new(val[1], val[2]) } - | WHILE Expression { result = WhileNode.new(val[1], nil) } - | Expression WHILE Expression { result = WhileNode.new(val[2], Expressions.wrap(val[0])) } - ; - - # Array comprehensions, including guard and current index. - # Looks a little confusing, check nodes.rb for the arguments to ForNode. - For: - Expression FOR - ForVariables ForSource { result = ForNode.new(val[0], val[3], val[2][0], val[2][1]) } - | FOR ForVariables ForSource Block { result = ForNode.new(val[3], val[2], val[1][0], val[1][1]) } - ; - - # An array comprehension has variables for the current element and index. - ForVariables: - IDENTIFIER { result = val } - | IDENTIFIER "," IDENTIFIER { result = [val[0], val[2]] } - ; - - # The source of the array comprehension can optionally be filtered. - ForSource: - IN Expression { result = {:source => val[1]} } - | OF Expression { result = {:source => val[1], :object => true} } - | ForSource - WHEN Expression { result = val[0].merge(:filter => val[2]) } - | ForSource - BY Expression { result = val[0].merge(:step => val[2]) } - ; - - # Switch/When blocks. - Switch: - SWITCH Expression INDENT - Whens OUTDENT { result = val[3].rewrite_condition(val[1]) } - | SWITCH Expression INDENT - Whens ELSE Block OUTDENT { result = val[3].rewrite_condition(val[1]).add_else(val[5]) } - ; - - # The inner list of whens. - Whens: - When { result = val[0] } - | Whens When { result = val[0] << val[1] } - ; - - # An individual when. - When: - LEADING_WHEN SimpleArgs Block { result = IfNode.new(val[1], val[2], nil, {:statement => true}) } - | LEADING_WHEN SimpleArgs Block - Terminator { result = IfNode.new(val[1], val[2], nil, {:statement => true}) } - | Comment Terminator When { result = val[2].add_comment(val[0]) } - ; - - # The most basic form of "if". - IfBlock: - IF Expression Block { result = IfNode.new(val[1], val[2]) } - ; - - # An elsif portion of an if-else block. - ElsIf: - ELSE IfBlock { result = val[1].force_statement } - ; - - # Multiple elsifs can be chained together. - ElsIfs: - ElsIf { result = val[0] } - | ElsIfs ElsIf { result = val[0].add_else(val[1]) } - ; - - # Terminating else bodies are strictly optional. - ElseBody - /* nothing */ { result = nil } - | ELSE Block { result = val[1] } - ; - - # All the alternatives for ending an if-else block. - IfEnd: - ElseBody { result = val[0] } - | ElsIfs ElseBody { result = val[0].add_else(val[1]) } - ; - - # The full complement of if blocks, including postfix one-liner ifs and unlesses. - If: - IfBlock IfEnd { result = val[0].add_else(val[1]) } - | Expression IF Expression { result = IfNode.new(val[2], Expressions.wrap(val[0]), nil, {:statement => true}) } - | Expression UNLESS Expression { result = IfNode.new(val[2], Expressions.wrap(val[0]), nil, {:statement => true, :invert => true}) } - ; - -end - ----- header -module CoffeeScript - ----- inner - # Lex and parse a CoffeeScript. - def parse(code) - # Uncomment the following line to enable grammar debugging, in combination - # with the -g flag in the Rake build task. - # @yydebug = true - @tokens = Lexer.new.tokenize(code) - do_parse - end - - # Retrieve the next token from the list. - def next_token - @tokens.shift - end - - # Raise a custom error class that knows about line numbers. - def on_error(error_token_id, error_value, value_stack) - raise ParseError.new(token_to_str(error_token_id), error_value, value_stack) - end - ----- footer -end \ No newline at end of file diff --git a/lib/coffee_script/lexer.rb b/lib/coffee_script/lexer.rb deleted file mode 100644 index af08eb56..00000000 --- a/lib/coffee_script/lexer.rb +++ /dev/null @@ -1,273 +0,0 @@ -module CoffeeScript - - # 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. - class Lexer - - # 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", - "try", "catch", "finally", "throw", - "break", "continue", - "for", "in", "of", "by", "where", "while", - "delete", "instanceof", "typeof", - "switch", "when", - "super", "extends"] - - # Token matching regexes. - IDENTIFIER = /\A([a-zA-Z$_](\w|\$)*)/ - NUMBER = /\A(\b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?(e[+\-]?[0-9]+)?)))\b/i - STRING = /\A(""|''|"(.*?)([^\\]|\\\\)"|'(.*?)([^\\]|\\\\)')/m - HEREDOC = /\A("{6}|'{6}|"{3}\n?(.*?)\n?([ \t]*)"{3}|'{3}\n?(.*?)\n?([ \t]*)'{3})/m - JS = /\A(``|`(.*?)([^\\]|\\\\)`)/m - OPERATOR = /\A([+\*&|\/\-%=<>:!?]+)/ - WHITESPACE = /\A([ \t]+)/ - COMMENT = /\A(((\n?[ \t]*)?#.*$)+)/ - CODE = /\A((-|=)>)/ - REGEX = /\A(\/(.*?)([^\\]|\\\\)\/[imgy]{0,4})/ - MULTI_DENT = /\A((\n([ \t]*))+)(\.)?/ - LAST_DENT = /\n([ \t]*)/ - ASSIGNMENT = /\A(:|=)\Z/ - - # Token cleaning regexes. - JS_CLEANER = /(\A`|`\Z)/ - MULTILINER = /\n/ - STRING_NEWLINES = /\n[ \t]*/ - COMMENT_CLEANER = /(^[ \t]*#|\n[ \t]*$)/ - NO_NEWLINE = /\A([+\*&|\/\-%=<>:!.\\][<>=&|]*|and|or|is|isnt|not|delete|typeof|instanceof)\Z/ - HEREDOC_INDENT = /^[ \t]+/ - - # 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. - def tokenize(code) - @code = code.chomp # Cleanup code by remove extra line breaks - @i = 0 # Current character position we're parsing - @line = 1 # The current line. - @indent = 0 # The current indent level. - @indents = [] # The stack of all indent levels we are currently within. - @tokens = [] # Collection of all parsed tokens in the form [:TOKEN_TYPE, value] - @spaced = nil # The last value that has a space following it. - while @i < @code.length - @chunk = @code[@i..-1] - extract_next_token - end - puts "original stream: #{@tokens.inspect}" if ENV['VERBOSE'] - close_indentation - Rewriter.new.rewrite(@tokens) - end - - # At every position, run through this list of attempted matches, - # short-circuiting if any of them succeed. - def extract_next_token - return if identifier_token - return if number_token - return if heredoc_token - return if string_token - return if js_token - return if regex_token - return if indent_token - return if comment_token - return if whitespace_token - return literal_token - end - - # Tokenizers ========================================================== - - # Matches identifying literals: variables, keywords, method names, etc. - def identifier_token - return false unless identifier = @chunk[IDENTIFIER, 1] - # Keywords are special identifiers tagged with their own name, - # 'if' will result in an [:IF, "if"] token. - tag = KEYWORDS.include?(identifier) ? identifier.upcase.to_sym : :IDENTIFIER - tag = :LEADING_WHEN if tag == :WHEN && [:OUTDENT, :INDENT, "\n"].include?(last_tag) - @tokens[-1][0] = :PROTOTYPE_ACCESS if tag == :IDENTIFIER && last_value == '::' - if tag == :IDENTIFIER && last_value == '.' && !(@tokens[-2] && @tokens[-2][1] == '.') - if @tokens[-2][0] == "?" - @tokens[-1][0] = :SOAK_ACCESS - @tokens.delete_at(-2) - else - @tokens[-1][0] = :PROPERTY_ACCESS - end - end - token(tag, identifier) - @i += identifier.length - end - - # Matches numbers, including decimals, hex, and exponential notation. - def number_token - return false unless number = @chunk[NUMBER, 1] - token(:NUMBER, number) - @i += number.length - end - - # Matches strings, including multi-line strings. - def string_token - return false unless string = @chunk[STRING, 1] - escaped = string.gsub(STRING_NEWLINES, " \\\n") - token(:STRING, escaped) - @line += string.count("\n") - @i += string.length - end - - # Matches heredocs, adjusting indentation to the correct level. - def heredoc_token - return false unless match = @chunk.match(HEREDOC) - doc = match[2] || match[4] - indent = doc.scan(HEREDOC_INDENT).min - doc.gsub!(/^#{indent}/, "") - doc.gsub!("\n", "\\n") - doc.gsub!('"', '\\"') - token(:STRING, "\"#{doc}\"") - @line += match[1].count("\n") - @i += match[1].length - end - - # Matches interpolated JavaScript. - def js_token - return false unless script = @chunk[JS, 1] - token(:JS, script.gsub(JS_CLEANER, '')) - @i += script.length - end - - # Matches regular expression literals. - def regex_token - return false unless regex = @chunk[REGEX, 1] - return false if NOT_REGEX.include?(last_tag) - token(:REGEX, regex) - @i += regex.length - end - - # Matches and consumes comments. - def comment_token - return false unless comment = @chunk[COMMENT, 1] - @line += comment.scan(MULTILINER).length - token(:COMMENT, comment.gsub(COMMENT_CLEANER, '').split(MULTILINER)) - token("\n", "\n") - @i += comment.length - end - - # Record tokens for indentation differing from the previous line. - def indent_token - return false unless indent = @chunk[MULTI_DENT, 1] - @line += indent.scan(MULTILINER).size - @i += indent.size - next_character = @chunk[MULTI_DENT, 4] - prev = @tokens[-2] - no_newlines = next_character == '.' || (last_value.to_s.match(NO_NEWLINE) && prev && prev[0] != '.' && !last_value.match(CODE)) - return suppress_newlines(indent) if no_newlines - size = indent.scan(LAST_DENT).last.last.length - return newline_token(indent) if size == @indent - if size > @indent - token(:INDENT, size - @indent) - @indents << (size - @indent) - else - outdent_token(@indent - size) - end - @indent = size - end - - # Record an oudent token or tokens, if we're moving back inwards past - # multiple recorded indents. - def outdent_token(move_out) - while move_out > 0 && !@indents.empty? - last_indent = @indents.pop - token(:OUTDENT, last_indent) - move_out -= last_indent - end - token("\n", "\n") - end - - # Matches and consumes non-meaningful whitespace. - def whitespace_token - return false unless whitespace = @chunk[WHITESPACE, 1] - @spaced = last_value - @i += whitespace.length - end - - # Multiple newlines get merged together. - # Use a trailing \ to escape newlines. - def newline_token(newlines) - token("\n", "\n") unless last_value == "\n" - true - end - - # Tokens to explicitly escape newlines are removed once their job is done. - def suppress_newlines(newlines) - @tokens.pop if last_value == "\\" - true - end - - # 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. - def literal_token - value = @chunk[OPERATOR, 1] - tag_parameters if value && value.match(CODE) - value ||= @chunk[0,1] - tag = value.match(ASSIGNMENT) ? :ASSIGN : value - if !@spaced.equal?(last_value) && CALLABLE.include?(last_tag) - tag = :CALL_START if value == '(' - tag = :INDEX_START if value == '[' - end - token(tag, value) - @i += value.length - end - - # Helpers ========================================================== - - # Add a token to the results, taking note of the line number. - def token(tag, value) - @tokens << [tag, Value.new(value, @line)] - end - - # Peek at the previous token's value. - def last_value - @tokens.last && @tokens.last[1] - end - - # Peek at the previous token's tag. - def last_tag - @tokens.last && @tokens.last[0] - end - - # 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. - def tag_parameters - return if last_tag != ')' - i = 0 - loop do - i -= 1 - tok = @tokens[i] - return if !tok - case tok[0] - when :IDENTIFIER then tok[0] = :PARAM - when ')' then tok[0] = :PARAM_END - when '(' then return tok[0] = :PARAM_START - end - end - end - - # Close up all remaining open blocks. IF the first token is an indent, - # axe it. - def close_indentation - outdent_token(@indent) - end - - end -end \ No newline at end of file diff --git a/lib/coffee_script/nodes.rb b/lib/coffee_script/nodes.rb deleted file mode 100644 index b6906ec7..00000000 --- a/lib/coffee_script/nodes.rb +++ /dev/null @@ -1,1037 +0,0 @@ -module CoffeeScript - - # The abstract base class for all CoffeeScript nodes. - # All nodes are implement a "compile_node" method, which performs the - # code generation for that node. To compile a node, call the "compile" - # method, which wraps "compile_node" in some extra smarts, to know when the - # generated code should be wrapped up in a closure. An options hash is passed - # and cloned throughout, containing messages from higher in the AST, - # information about the current scope, and indentation level. - class Node - # Tabs are two spaces for pretty-printing. - TAB = ' ' - - # Tag this node as a statement, meaning that it can't be used directly as - # the result of an expression. - def self.statement - class_eval "def statement?; true; end" - end - - # Tag this node as a statement that cannot be transformed into an expression. - # (break, continue, etc.) It doesn't make sense to try to transform it. - def self.statement_only - statement - class_eval "def statement_only?; true; end" - end - - # This node needs to know if it's being compiled as a top-level statement, - # in order to compile without special expression conversion. - def self.top_sensitive - class_eval "def top_sensitive?; true; end" - end - - # Provide a quick implementation of a children method. - def self.children(*attributes) - attr_reader(*attributes) - attrs = attributes.map {|a| "[@#{a}]" }.join(', ') - class_eval "def children; [#{attrs}].flatten.compact; end" - end - - def write(code) - puts "#{self.class.to_s}:\n#{@options.inspect}\n#{code}\n\n" if ENV['VERBOSE'] - code - end - - # This is extremely important -- we convert JS statements into expressions - # by wrapping them in a closure, only if it's possible, and we're not at - # the top level of a block (which would be unnecessary), and we haven't - # already been asked to return the result. - def compile(o={}) - @options = o.dup - @indent = o[:indent] - top = self.top_sensitive? ? @options[:top] : @options.delete(:top) - closure = statement? && !statement_only? && !top && !@options[:return] && !self.is_a?(CommentNode) - closure &&= !contains? {|n| n.statement_only? } - closure ? compile_closure(@options) : compile_node(@options) - end - - # Statements converted into expressions share scope with their parent - # closure, to preserve JavaScript-style lexical scope. - def compile_closure(o={}) - @indent = o[:indent] - ClosureNode.wrap(self).compile(o.merge(:shared_scope => o[:scope])) - end - - # Quick short method for the current indentation level, plus tabbing in. - def idt(tabs=0) - @indent + (TAB * tabs) - end - - # Does this node, or any of its children, contain a node of a certain kind? - def contains?(&block) - children.each do |node| - return true if yield(node) - return true if node.is_a?(Node) && node.contains?(&block) - end - false - end - - # Default implementations of the common node methods. - def unwrap; self; end - def children; []; end - def statement?; false; end - def statement_only?; false; end - def top_sensitive?; false; end - end - - # A collection of nodes, each one representing an expression. - class Expressions < Node - statement - children :expressions - attr_accessor :function - - TRAILING_WHITESPACE = /\s+$/ - - # Wrap up a node as an Expressions, unless it already is. - def self.wrap(*nodes) - return nodes[0] if nodes.length == 1 && nodes[0].is_a?(Expressions) - Expressions.new(*nodes) - end - - def initialize(*nodes) - @expressions = nodes.flatten - end - - # Tack an expression on to the end of this expression list. - def <<(node) - @expressions << node - self - end - - # Tack an expression on to the beginning of this expression list. - def unshift(node) - @expressions.unshift(node) - self - end - - # If this Expressions consists of a single node, pull it back out. - def unwrap - @expressions.length == 1 ? @expressions.first : self - end - - # Is this an empty block of code? - def empty? - @expressions.empty? - end - - # Is the node last in this block of expressions? - def last?(node) - @last_index ||= @expressions.last.is_a?(CommentNode) ? -2 : -1 - node == @expressions[@last_index] - end - - def compile(o={}) - o[:scope] ? super(o) : compile_root(o) - end - - # Compile each expression in the Expressions body. - def compile_node(o={}) - write(@expressions.map {|n| compile_expression(n, o.dup) }.join("\n")) - end - - # If this is the top-level Expressions, wrap everything in a safety closure. - def compile_root(o={}) - indent = o[:no_wrap] ? '' : TAB - @indent = indent - o.merge!(:indent => indent, :scope => Scope.new(nil, self, nil)) - code = o[:globals] ? compile_node(o) : compile_with_declarations(o) - code.gsub!(TRAILING_WHITESPACE, '') - write(o[:no_wrap] ? code : "(function(){\n#{code}\n})();") - end - - # Compile the expressions body, with declarations of all inner variables - # pushed up to the top. - def compile_with_declarations(o={}) - code = compile_node(o) - args = self.contains? {|n| n.is_a?(ValueNode) && n.arguments? } - argv = args && o[:scope].check('arguments') ? '' : 'var ' - code = "#{idt}#{argv}arguments = Array.prototype.slice.call(arguments, 0);\n#{code}" if args - code = "#{idt}var #{o[:scope].compiled_assignments};\n#{code}" if o[:scope].assignments?(self) - code = "#{idt}var #{o[:scope].compiled_declarations};\n#{code}" if o[:scope].declarations?(self) - write(code) - end - - # Compiles a single expression within the expressions body. - def compile_expression(node, o) - @indent = o[:indent] - stmt = node.statement? - # We need to return the result if this is the last node in the expressions body. - returns = o.delete(:return) && last?(node) && !node.statement_only? - # Return the regular compile of the node, unless we need to return the result. - return "#{stmt ? '' : idt}#{node.compile(o.merge(:top => true))}#{stmt ? '' : ';'}" unless returns - # If it's a statement, the node knows how to return itself. - return node.compile(o.merge(:return => true)) if node.statement? - # Otherwise, we can just return the value of the expression. - return "#{idt}return #{node.compile(o)};" - end - - end - - # Literals are static values that can be passed through directly into - # JavaScript without translation, eg.: strings, numbers, true, false, null... - class LiteralNode < Node - children :value - - # Values of a literal node that much be treated as a statement -- no - # sense returning or assigning them. - STATEMENTS = ['break', 'continue'] - - # Wrap up a compiler-generated string as a LiteralNode. - def self.wrap(string) - self.new(Value.new(string)) - end - - def initialize(value) - @value = value - end - - def statement? - STATEMENTS.include?(@value.to_s) - end - alias_method :statement_only?, :statement? - - def compile_node(o) - indent = statement? ? idt : '' - ending = statement? ? ';' : '' - "#{indent}#{@value}#{ending}" - end - end - - # Return an expression, or wrap it in a closure and return it. - class ReturnNode < Node - statement_only - children :expression - - def initialize(expression) - @expression = expression - end - - def compile_node(o) - return write(@expression.compile(o.merge(:return => true))) if @expression.statement? - compiled = @expression.compile(o) - write("#{idt}return #{compiled};") - end - end - - # A value, indexed or dotted into, or vanilla. - class ValueNode < Node - children :base, :properties - attr_reader :last, :source - - # Soak up undefined properties and call attempts. - SOAK = " == undefined ? undefined : " - - def initialize(base, properties=[]) - @base, @properties = base, [properties].flatten - end - - def <<(other) - @properties << other - self - end - - def properties? - return !@properties.empty? || @base.is_a?(ThisNode) - end - - def array? - @base.is_a?(ArrayNode) && !properties? - end - - def object? - @base.is_a?(ObjectNode) && !properties? - end - - def splice? - properties? && @properties.last.is_a?(SliceNode) - end - - def arguments? - @base.to_s == 'arguments' - end - - def unwrap - @properties.empty? ? @base : self - end - - # Values are statements if their base is a statement. - def statement? - @base.is_a?(Node) && @base.statement? && !properties? - end - - def compile_node(o) - soaked = false - only = o.delete(:only_first) - props = only ? @properties[0...-1] : @properties - baseline = @base.compile(o) - parts = [baseline.dup] - props.each do |prop| - if prop.is_a?(AccessorNode) && prop.soak - soaked = true - if @base.is_a?(CallNode) && prop == props.first - temp = o[:scope].free_variable - parts[-1] = "(#{temp} = #{baseline})#{SOAK}#{baseline = temp.to_s + prop.compile(o)}" - else - parts[-1] << "#{SOAK}#{baseline += prop.compile(o)}" - end - else - part = prop.compile(o) - baseline += part - parts << part - end - end - @last = parts.last - @source = parts.length > 1 ? parts[0...-1].join('') : nil - code = parts.join('').gsub(')())', '()))') - write(soaked ? "(#{code})" : code) - end - end - - # Pass through CoffeeScript comments into JavaScript comments at the - # same position. - class CommentNode < Node - statement - - def initialize(lines) - @lines = lines.value - end - - def compile_node(o={}) - delimiter = "\n#{idt}//" - write("#{delimiter}#{@lines.join(delimiter)}") - end - - end - - # Node for a function invocation. Takes care of converting super() calls into - # calls against the prototype's function of the same name. - class CallNode < Node - children :variable, :arguments - - def initialize(variable, arguments=[]) - @variable, @arguments = variable, arguments - @prefix = '' - end - - def new_instance - @prefix = "new " - self - end - - def <<(argument) - @arguments << argument - self - end - - # Compile a vanilla function call. - def compile_node(o) - return write(compile_splat(o)) if @arguments.any? {|a| a.is_a?(SplatNode) } - args = @arguments.map{|a| a.compile(o) }.join(', ') - return write(compile_super(args, o)) if @variable == 'super' - write("#{@prefix}#{@variable.compile(o)}(#{args})") - end - - # Compile a call against the superclass's implementation of the current function. - def compile_super(args, o) - methname = o[:scope].function.name - arg_part = args.empty? ? '' : ", #{args}" - meth = o[:scope].function.proto ? - "#{o[:scope].function.proto}.__superClass__.#{methname}" : - "#{methname}.__superClass__.constructor" - "#{meth}.call(this#{arg_part})" - end - - # Compile a function call being passed variable arguments. - def compile_splat(o) - meth = @variable.compile(o) - obj = @variable.source || 'this' - args = @arguments.map do |arg| - code = arg.compile(o) - code = arg.is_a?(SplatNode) ? code : "[#{code}]" - arg.equal?(@arguments.first) ? code : ".concat(#{code})" - end - "#{@prefix}#{meth}.apply(#{obj}, #{args.join('')})" - end - - # If the code generation wished to use the result of a function call - # in multiple places, ensure that the function is only ever called once. - def compile_reference(o) - reference = o[:scope].free_variable - call = ParentheticalNode.new(AssignNode.new(reference, self)) - return call, reference - end - end - - # Node to extend an object's prototype with an ancestor object. - # After goog.inherits from the Closure Library. - class ExtendsNode < Node - children :sub_object, :super_object - statement - - def initialize(sub_object, super_object) - @sub_object, @super_object = sub_object, super_object - end - - # Hooking one constructor into another's prototype chain. - def compile_node(o={}) - constructor = o[:scope].free_variable - sub, sup = @sub_object.compile(o), @super_object.compile(o) - "#{idt}#{constructor} = function(){};\n#{idt}" + - "#{constructor}.prototype = #{sup}.prototype;\n#{idt}" + - "#{sub}.__superClass__ = #{sup}.prototype;\n#{idt}" + - "#{sub}.prototype = new #{constructor}();\n#{idt}" + - "#{sub}.prototype.constructor = #{sub};" - end - - end - - # A dotted accessor into a part of a value, or the :: shorthand for - # an accessor into the object's prototype. - class AccessorNode < Node - children :name - attr_reader :soak - - def initialize(name, tag=nil) - @name = name - @prototype = tag == :prototype - @soak = tag == :soak - end - - def compile_node(o) - proto = @prototype ? "prototype." : '' - write(".#{proto}#{@name}") - end - end - - # An indexed accessor into a part of an array or object. - class IndexNode < Node - children :index - - def initialize(index) - @index = index - end - - def compile_node(o) - write("[#{@index.compile(o)}]") - end - end - - # A this-reference, using '@'. - class ThisNode < Node - def initialize(property=nil) - @property = property - end - - def compile_node(o) - prop = @property ? ".#{@property}" : '' - write("this#{prop}") - end - end - - # A range literal. Ranges can be used to extract portions (slices) of arrays, - # or to specify a range for list comprehensions. - class RangeNode < Node - children :from, :to - - def initialize(from, to, exclusive=false) - @from, @to, @exclusive = from, to, exclusive - end - - def exclusive? - @exclusive - end - - def compile_variables(o) - @indent = o[:indent] - @from_var, @to_var = o[:scope].free_variable, o[:scope].free_variable - from_val, to_val = @from.compile(o), @to.compile(o) - write("#{@from_var} = #{from_val}; #{@to_var} = #{to_val};\n#{idt}") - end - - def compile_node(o) - return compile_array(o) unless o[:index] - idx, step = o.delete(:index), o.delete(:step) - vars = "#{idx}=#{@from_var}" - step = step ? step.compile(o) : '1' - equals = @exclusive ? '' : '=' - intro = "(#{@from_var} <= #{@to_var} ? #{idx}" - compare = "#{intro} <#{equals} #{@to_var} : #{idx} >#{equals} #{@to_var})" - incr = "#{intro} += #{step} : #{idx} -= #{step})" - write("#{vars}; #{compare}; #{incr}") - end - - # Expand the range into the equivalent array, if it's not being used as - # part of a comprehension, slice, or splice. - # TODO: This generates pretty ugly code ... shrink it. - def compile_array(o) - body = Expressions.wrap(LiteralNode.wrap('i')) - arr = Expressions.wrap(ForNode.new(body, {:source => ValueNode.new(self)}, Value.new('i'))) - ParentheticalNode.new(CallNode.new(CodeNode.new([], arr))).compile(o) - end - - end - - # An array slice literal. Unlike JavaScript's Array#slice, the second parameter - # specifies the index of the end of the slice (just like the first parameter) - # is the index of the beginning. - class SliceNode < Node - children :range - - def initialize(range) - @range = range - end - - def compile_node(o) - from = @range.from.compile(o) - to = @range.to.compile(o) - plus_part = @range.exclusive? ? '' : ' + 1' - write(".slice(#{from}, #{to}#{plus_part})") - end - end - - # An object literal. - class ObjectNode < Node - children :properties - alias_method :objects, :properties - - def initialize(properties = []) - @properties = properties - end - - # All the mucking about with commas is to make sure that CommentNodes and - # AssignNodes get interleaved correctly, with no trailing commas or - # commas affixed to comments. TODO: Extract this and add it to ArrayNode. - def compile_node(o) - o[:indent] = idt(1) - joins = Hash.new("\n") - non_comments = @properties.select {|p| !p.is_a?(CommentNode) } - non_comments.each {|p| joins[p] = p == non_comments.last ? "\n" : ",\n" } - props = @properties.map { |prop| - join = joins[prop] - join = '' if prop == @properties.last - indent = prop.is_a?(CommentNode) ? '' : idt(1) - "#{indent}#{prop.compile(o)}#{join}" - }.join('') - write("{\n#{props}\n#{idt}}") - end - end - - # An array literal. - class ArrayNode < Node - children :objects - - def initialize(objects=[]) - @objects = objects - end - - def compile_node(o) - o[:indent] = idt(1) - objects = @objects.map { |obj| - code = obj.compile(o) - obj.is_a?(CommentNode) ? "\n#{code}\n#{o[:indent]}" : - obj == @objects.last ? code : "#{code}, " - }.join('') - ending = objects.include?("\n") ? "\n#{idt}]" : ']' - write("[#{objects}#{ending}") - end - end - - # A faux-node that is never created by the grammar, but is used during - # code generation to generate a quick "array.push(value)" tree of nodes. - class PushNode - def self.wrap(array, expressions) - expr = expressions.unwrap - return expressions if expr.statement_only? || expr.contains? {|n| n.statement_only? } - Expressions.wrap(CallNode.new( - ValueNode.new(LiteralNode.new(array), [AccessorNode.new(Value.new('push'))]), - [expr] - )) - end - end - - # A faux-node used to wrap an expressions body in a closure. - class ClosureNode - def self.wrap(expressions, statement=false) - func = ParentheticalNode.new(CodeNode.new([], Expressions.wrap(expressions))) - call = CallNode.new(ValueNode.new(func, AccessorNode.new(Value.new('call'))), [Value.new('this')]) - statement ? Expressions.wrap(call) : call - end - end - - # Setting the value of a local variable, or the value of an object property. - class AssignNode < Node - top_sensitive - children :variable, :value - - PROTO_ASSIGN = /\A(\S+)\.prototype/ - LEADING_DOT = /\A\.(prototype\.)?/ - - def initialize(variable, value, context=nil) - @variable, @value, @context = variable, value, context - end - - def value? - @variable.is_a?(ValueNode) - end - - def statement? - value? && (@variable.array? || @variable.object?) - end - - def compile_node(o) - top = o.delete(:top) - return compile_pattern_match(o) if statement? - return compile_splice(o) if value? && @variable.splice? - stmt = o.delete(:as_statement) - name = @variable.compile(o) - last = value? ? @variable.last.to_s.sub(LEADING_DOT, '') : name - proto = name[PROTO_ASSIGN, 1] - if @value.is_a?(CodeNode) - @value.name = last if last.match(Lexer::IDENTIFIER) - @value.proto = proto if proto - end - return write("#{name}: #{@value.compile(o)}") if @context == :object - o[:scope].find(name) unless value? && @variable.properties? - val = "#{name} = #{@value.compile(o)}" - return write("#{idt}#{val};") if stmt - val = "(#{val})" if !top || o[:return] - val = "#{idt}return #{val}" if o[:return] - write(val) - end - - # Implementation of recursive pattern matching, when assigning array or - # object literals to a value. Peeks at their properties to assign inner names. - # See: http://wiki.ecmascript.org/doku.php?id=harmony:destructuring - def compile_pattern_match(o) - val_var = o[:scope].free_variable - assigns = ["#{idt}#{val_var} = #{@value.compile(o)};"] - o.merge!(:top => true, :as_statement => true) - @variable.base.objects.each_with_index do |obj, i| - obj, i = obj.value, obj.variable.base if @variable.object? - access_class = @variable.array? ? IndexNode : AccessorNode - if obj.is_a?(SplatNode) - val = LiteralNode.wrap(obj.compile_value(o, val_var, @variable.base.objects.index(obj))) - else - val = ValueNode.new(val_var, [access_class.new(Value.new(i.to_s))]) - end - assigns << AssignNode.new(obj, val).compile(o) - end - write(assigns.join("\n")) - end - - def compile_splice(o) - var = @variable.compile(o.merge(:only_first => true)) - range = @variable.properties.last.range - plus = range.exclusive? ? '' : ' + 1' - from = range.from.compile(o) - to = "#{range.to.compile(o)} - #{from}#{plus}" - write("#{var}.splice.apply(#{var}, [#{from}, #{to}].concat(#{@value.compile(o)}))") - end - end - - # A function definition. The only node that creates a new Scope. - # A CodeNode does not have any children -- they're within the new scope. - class CodeNode < Node - top_sensitive - attr_reader :params, :body, :bound - attr_accessor :name, :proto - - def initialize(params, body, tag=nil) - @params = params - @body = body - @bound = tag == :boundfunc - end - - def compile_node(o) - shared_scope = o.delete(:shared_scope) - top = o.delete(:top) - o[:scope] = shared_scope || Scope.new(o[:scope], @body, self) - o[:return] = true - o[:top] = true - o[:indent] = idt(@bound ? 2 : 1) - o.delete(:no_wrap) - o.delete(:globals) - if @params.last.is_a?(SplatNode) - splat = @params.pop - splat.index = @params.length - @body.unshift(splat) - end - @params.each {|id| o[:scope].parameter(id.to_s) } - code = @body.empty? ? "" : "\n#{@body.compile_with_declarations(o)}\n" - name_part = @name ? " #{@name}" : '' - func = "function#{@bound ? '' : name_part}(#{@params.join(', ')}) {#{code}#{idt(@bound ? 1 : 0)}}" - func = "(#{func})" if top && !@bound - return write(func) unless @bound - inner = "(function#{name_part}() {\n#{idt(2)}return __func.apply(__this, arguments);\n#{idt(1)}});" - write("(function(__this) {\n#{idt(1)}var __func = #{func};\n#{idt(1)}return #{inner}\n#{idt}})(this)") - end - end - - # A splat, either as a parameter to a function, an argument to a call, - # or in a destructuring assignment. - class SplatNode < Node - children :name - attr_accessor :index - - def initialize(name) - @name = name - end - - def compile_node(o={}) - write(@index ? compile_param(o) : @name.compile(o)) - end - - def compile_param(o) - o[:scope].find(@name) - "#{@name} = Array.prototype.slice.call(arguments, #{@index})" - end - - def compile_value(o, name, index) - "Array.prototype.slice.call(#{name}, #{index})" - end - - end - - # A while loop, the only sort of low-level loop exposed by CoffeeScript. From - # it, all other loops can be manufactured. - class WhileNode < Node - top_sensitive - children :condition, :body - statement - - def initialize(condition, body) - @condition, @body = condition, body - end - - def compile_node(o) - returns = o.delete(:return) - top = o.delete(:top) && !returns - o[:indent] = idt(1) - o[:top] = true - cond = @condition.compile(o) - set = '' - if !top - rvar = o[:scope].free_variable - set = "#{idt}#{rvar} = [];\n" - @body = PushNode.wrap(rvar, @body) - end - post = returns ? "\n#{idt}return #{rvar};" : '' - return write("#{set}#{idt}while (#{cond}) null;#{post}") if @body.nil? - write("#{set}#{idt}while (#{cond}) {\n#{@body.compile(o)}\n#{idt}}#{post}") - end - end - - # Simple Arithmetic and logical operations. Performs some conversion from - # CoffeeScript operations into their JavaScript equivalents. - class OpNode < Node - children :first, :second - attr_reader :operator - attr_accessor :second - - CONVERSIONS = { - :== => "===", - :'!=' => "!==", - :and => '&&', - :or => '||', - :is => '===', - :isnt => "!==", - :not => '!' - } - CHAINABLE = [:<, :>, :>=, :<=, :===, :'!=='] - ASSIGNMENT = [:'||=', :'&&=', :'?='] - PREFIX_OPERATORS = [:typeof, :delete] - - def initialize(operator, first, second=nil, flip=false) - @first, @second, @flip = first, second, flip - @operator = CONVERSIONS[operator.to_sym] || operator - end - - def unary? - @second.nil? - end - - def chainable? - CHAINABLE.include?(operator.to_sym) - end - - def compile_node(o) - return write(compile_chain(o)) if chainable? && @first.unwrap.is_a?(OpNode) && @first.unwrap.chainable? - return write(compile_assignment(o)) if ASSIGNMENT.include?(@operator.to_sym) - return write(compile_unary(o)) if unary? - return write(compile_existence(o)) if @operator == '?' - write("#{@first.compile(o)} #{@operator} #{@second.compile(o)}") - end - - # Mimic Python's chained comparisons. See: - # http://docs.python.org/reference/expressions.html#notin - def compile_chain(o) - shared = @first.unwrap.second - @first.second, shared = *shared.compile_reference(o) if shared.is_a?(CallNode) - "(#{@first.compile(o)}) && (#{shared.compile(o)} #{@operator} #{@second.compile(o)})" - end - - def compile_assignment(o) - first, second = @first.compile(o), @second.compile(o) - o[:scope].find(first) if @first.unwrap.is_a?(Value) - return "#{first} = #{ExistenceNode.compile_test(o, @first)} ? #{first} : #{second}" if @operator == '?=' - "#{first} = #{first} #{@operator[0..1]} #{second}" - end - - def compile_existence(o) - first, second = @first.compile(o), @second.compile(o) - "#{ExistenceNode.compile_test(o, @first)} ? #{first} : #{second}" - end - - def compile_unary(o) - space = PREFIX_OPERATORS.include?(@operator.to_sym) ? ' ' : '' - parts = [@operator.to_s, space, @first.compile(o)] - parts.reverse! if @flip - parts.join('') - end - end - - # A try/catch/finally block. - class TryNode < Node - children :try, :recovery, :finally - attr_reader :error - statement - - def initialize(try, error, recovery, finally=nil) - @try, @error, @recovery, @finally = try, error, recovery, finally - end - - def compile_node(o) - o[:indent] = idt(1) - o[:top] = true - error_part = @error ? " (#{@error}) " : ' ' - catch_part = @recovery && " catch#{error_part}{\n#{@recovery.compile(o)}\n#{idt}}" - finally_part = @finally && " finally {\n#{@finally.compile(o.merge(:return => nil))}\n#{idt}}" - write("#{idt}try {\n#{@try.compile(o)}\n#{idt}}#{catch_part}#{finally_part}") - end - end - - # Throw an exception. - class ThrowNode < Node - children :expression - statement_only - - def initialize(expression) - @expression = expression - end - - def compile_node(o) - write("#{idt}throw #{@expression.compile(o)};") - end - end - - # Check an expression for existence (meaning not null or undefined). - class ExistenceNode < Node - children :expression - - def self.compile_test(o, variable) - first, second = variable, variable - first, second = *variable.compile_reference(o) if variable.is_a?(CallNode) - "(typeof #{first.compile(o)} !== \"undefined\" && #{second.compile(o)} !== null)" - end - - def initialize(expression) - @expression = expression - end - - def compile_node(o) - write(ExistenceNode.compile_test(o, @expression)) - end - end - - # An extra set of parentheses, specified explicitly in the source. - class ParentheticalNode < Node - children :expressions - - def initialize(expressions, line=nil) - @expressions = expressions.unwrap - @line = line - end - - def compile_node(o) - compiled = @expressions.compile(o) - compiled = compiled[0...-1] if compiled[-1..-1] == ';' - write("(#{compiled})") - end - end - - # The replacement for the for loop is an array comprehension (that compiles) - # into a for loop. Also acts as an expression, able to return the result - # of the comprehenion. Unlike Python array comprehensions, it's able to pass - # the current index of the loop as a second parameter. - class ForNode < Node - top_sensitive - children :body, :source, :filter - attr_reader :name, :index, :step - statement - - def initialize(body, source, name, index=nil) - @body, @name, @index = body, name, index - @source = source[:source] - @filter = source[:filter] - @step = source[:step] - @object = !!source[:object] - @name, @index = @index, @name if @object - end - - def compile_node(o) - top_level = o.delete(:top) && !o[:return] - range = @source.is_a?(ValueNode) && @source.base.is_a?(RangeNode) && @source.properties.empty? - source = range ? @source.base : @source - scope = o[:scope] - name_found = @name && scope.find(@name) - index_found = @index && scope.find(@index) - body_dent = idt(1) - rvar = scope.free_variable unless top_level - svar = scope.free_variable - ivar = range ? name : @index ? @index : scope.free_variable - var_part = '' - body = Expressions.wrap(@body) - if range - index_var = scope.free_variable - source_part = source.compile_variables(o) - for_part = "#{index_var}=0, #{source.compile(o.merge(:index => ivar, :step => @step))}, #{index_var}++" - else - index_var = nil - source_part = "#{svar} = #{@source.compile(o)};\n#{idt}" - step_part = @step ? "#{ivar} += #{@step.compile(o)}" : "#{ivar}++" - for_part = @object ? "#{ivar} in #{svar}" : "#{ivar} = 0; #{ivar} < #{svar}.length; #{step_part}" - var_part = "#{body_dent}#{@name} = #{svar}[#{ivar}];\n" if @name - end - set_result = rvar ? "#{idt}#{rvar} = []; " : idt - return_result = rvar || '' - body = ClosureNode.wrap(body, true) if top_level && contains? {|n| n.is_a? CodeNode } - body = PushNode.wrap(rvar, body) unless top_level - if o[:return] - return_result = "return #{return_result}" - o.delete(:return) - body = IfNode.new(@filter, body, nil, :statement => true) if @filter - elsif @filter - body = Expressions.wrap(IfNode.new(@filter, body)) - end - if @object - o[:scope].assign("__hasProp", "Object.prototype.hasOwnProperty", true) - body = Expressions.wrap(IfNode.new( - CallNode.new( - ValueNode.new(LiteralNode.wrap("__hasProp"), [AccessorNode.new(Value.new('call'))]), - [LiteralNode.wrap(svar), LiteralNode.wrap(ivar)] - ), - Expressions.wrap(body), nil, {:statement => true} - )) - end - - return_result = "\n#{idt}#{return_result};" unless top_level - body = body.compile(o.merge(:indent => body_dent, :top => true)) - vars = range ? @name : "#{@name}, #{ivar}" - return write(set_result + source_part + "for (#{for_part}) {\n#{var_part}#{body}\n#{idt}}\n#{idt}#{return_result}") - end - end - - # If/else statements. Switch/whens get compiled into these. Acts as an - # expression by pushing down requested returns to the expression bodies. - # Single-expression IfNodes are compiled into ternary operators if possible, - # because ternaries are first-class returnable assignable expressions. - class IfNode < Node - children :condition, :body, :else_body - - def initialize(condition, body, else_body=nil, tags={}) - @condition = condition - @body = body && body.unwrap - @else_body = else_body && else_body.unwrap - @tags = tags - @multiple = true if @condition.is_a?(Array) - @condition = OpNode.new("!", ParentheticalNode.new(@condition)) if @tags[:invert] - end - - def <<(else_body) - eb = else_body.unwrap - @else_body ? @else_body << eb : @else_body = eb - self - end - - def add_comment(comment) - @comment = comment - self - end - - def force_statement - @tags[:statement] = true - self - end - - # Rewrite a chain of IfNodes with their switch condition for equality. - def rewrite_condition(expression) - @condition = @multiple ? @condition.map {|c| OpNode.new("is", expression, c) } : - OpNode.new("is", expression, @condition) - @else_body.rewrite_condition(expression) if chain? - self - end - - # Rewrite a chain of IfNodes to add a default case as the final else. - def add_else(exprs) - chain? ? @else_body.add_else(exprs) : @else_body = (exprs && exprs.unwrap) - self - end - - # If the else_body is an IfNode itself, then we've got an if-else chain. - def chain? - @chain ||= @else_body && @else_body.is_a?(IfNode) - end - - # The IfNode only compiles into a statement if either of the bodies needs - # to be a statement. - def statement? - @is_statement ||= !!(@comment || @tags[:statement] || @body.statement? || (@else_body && @else_body.statement?)) - end - - def compile_condition(o) - [@condition].flatten.map {|c| c.compile(o) }.join(' || ') - end - - def compile_node(o) - write(statement? ? compile_statement(o) : compile_ternary(o)) - end - - # Compile the IfNode as a regular if-else statement. Flattened chains - # force sub-else bodies into statement form. - def compile_statement(o) - child = o.delete(:chain_child) - cond_o = o.dup - cond_o.delete(:return) - o[:indent] = idt(1) - o[:top] = true - if_dent = child ? '' : idt - com_dent = child ? idt : '' - prefix = @comment ? @comment.compile(cond_o) + "\n#{com_dent}" : '' - body = Expressions.wrap(@body).compile(o) - if_part = "#{prefix}#{if_dent}if (#{compile_condition(cond_o)}) {\n#{body}\n#{idt}}" - return if_part unless @else_body - else_part = chain? ? - " else #{@else_body.compile(o.merge(:indent => idt, :chain_child => true))}" : - " else {\n#{Expressions.wrap(@else_body).compile(o)}\n#{idt}}" - if_part + else_part - end - - # Compile the IfNode into a ternary operator. - def compile_ternary(o) - if_part = "#{@condition.compile(o)} ? #{@body.compile(o)}" - else_part = @else_body ? @else_body.compile(o) : 'null' - "#{if_part} : #{else_part}" - end - end - -end \ No newline at end of file diff --git a/lib/coffee_script/parse_error.rb b/lib/coffee_script/parse_error.rb deleted file mode 100644 index 4903deb5..00000000 --- a/lib/coffee_script/parse_error.rb +++ /dev/null @@ -1,29 +0,0 @@ -module CoffeeScript - - # Racc will raise this Exception whenever a syntax error occurs. The main - # benefit over the Racc::ParseError is that the CoffeeScript::ParseError is - # line-number aware. - class ParseError < Racc::ParseError - - TOKEN_MAP = { - 'INDENT' => 'indent', - 'OUTDENT' => 'outdent', - "\n" => 'newline' - } - - def initialize(token_id, value, stack=nil, message=nil) - @token_id, @value, @stack, @message = token_id, value, stack, message - end - - def message - line = @value.respond_to?(:line) ? @value.line : "END" - line_part = "line #{line}:" - id_part = @token_id != @value.to_s ? " unexpected #{@token_id.to_s.downcase}" : "" - val_part = @message || "for #{TOKEN_MAP[@value.to_s] || "'#{@value}'"}" - "#{line_part} syntax error, #{val_part}#{id_part}" - end - alias_method :inspect, :message - - end - -end \ No newline at end of file diff --git a/lib/coffee_script/parser.rb b/lib/coffee_script/parser.rb deleted file mode 100644 index bbeb95b2..00000000 --- a/lib/coffee_script/parser.rb +++ /dev/null @@ -1,2628 +0,0 @@ -# -# DO NOT MODIFY!!!! -# This file is automatically generated by Racc 1.4.6 -# from Racc grammer file "". -# - -require 'racc/parser.rb' - -module CoffeeScript - -class Parser < Racc::Parser - -module_eval(<<'...end grammar.y/module_eval...', 'grammar.y', 463) - # Lex and parse a CoffeeScript. - def parse(code) - # Uncomment the following line to enable grammar debugging, in combination - # with the -g flag in the Rake build task. - # @yydebug = true - @tokens = Lexer.new.tokenize(code) - do_parse - end - - # Retrieve the next token from the list. - def next_token - @tokens.shift - end - - # Raise a custom error class that knows about line numbers. - def on_error(error_token_id, error_value, value_stack) - raise ParseError.new(token_to_str(error_token_id), error_value, value_stack) - end - -...end grammar.y/module_eval... -##### State transition tables begin ### - -clist = [ -'136,200,144,29,32,35,39,43,46,52,57,62,65,163,60,182,163,8,14,60,-186', -'-186,281,-186,-186,105,106,107,289,290,58,66,132,137,103,264,104,152', -'214,215,293,167,60,50,302,8,14,202,55,200,292,163,199,72,3,111,172,173', -'151,155,158,161,165,166,131,135,140,143,147,150,154,157,160,164,169', -'130,134,139,142,146,149,153,156,159,162,168,129,133,138,141,145,148', -'181,8,14,202,12,27,252,33,36,12,41,206,29,32,35,39,43,46,52,57,62,65', -'60,273,289,290,2,211,186,21,26,180,296,96,98,42,96,98,53,58,66,67,95', -'8,14,95,7,13,60,22,200,34,37,60,269,116,50,55,114,8,14,208,209,74,5', -'10,16,19,24,314,264,8,14,45,48,8,14,50,50,163,50,298,99,163,96,98,-186', -'-186,96,98,151,155,187,95,8,14,202,95,8,14,192,72,3,188,264,78,27,259', -'33,36,12,41,50,29,32,35,39,43,46,52,57,62,65,81,8,14,60,2,50,60,21,26', -'50,60,99,196,42,96,98,53,58,66,67,214,215,81,95,7,13,197,22,198,34,37', -'122,285,60,50,55,283,319,105,106,107,74,5,10,16,19,24,103,163,104,315', -'45,48,163,282,-186,-186,78,50,210,151,155,158,161,165,166,131,135,140', -'143,147,150,154,157,105,106,107,280,126,72,3,213,126,103,27,104,33,36', -'12,41,,29,32,35,39,43,46,52,57,62,65,105,106,107,,2,,,21,26,103,,104', -',42,163,,53,58,66,67,,151,155,,7,13,,22,,34,37,163,,,50,55,,167,-186', -'-186,,74,5,10,16,19,24,163,,,,45,48,,151,155,158,161,165,166,131,135', -'140,143,147,150,154,157,160,164,169,130,134,139,142,146,,,,72,3,8,14', -'192,27,190,33,36,12,41,,29,32,35,39,43,46,52,57,62,65,105,106,107,,2', -',,21,26,103,,104,,42,163,,53,58,66,67,,-186,-186,,7,13,,22,,34,37,163', -',,50,55,,167,151,155,,74,5,10,16,19,24,163,,,,45,48,,151,155,158,161', -'165,166,131,135,140,143,147,150,154,157,160,164,169,130,134,139,142', -'146,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65,105,106', -'107,,2,,,21,26,103,,104,,42,163,,53,58,66,67,,-186,-186,,7,13,,22,,34', -'37,163,,,50,55,,167,-186,-186,,74,5,10,16,19,24,163,,,,45,48,,151,155', -'158,161,165,166,131,135,140,143,147,150,154,157,160,164,169,130,134', -'139,142,146,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65', -',,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,167', -',,,74,5,10,16,19,24,163,,,,45,48,,151,155,158,161,165,166,131,135,140', -'143,147,150,154,157,160,164,169,130,134,139,142,146,,,,72,3,,,,27,,33', -'36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58', -'66,67,,,,,7,13,,22,,34,37,,,,50,55,,167,,,,74,5,10,16,19,24,163,,,,45', -'48,,151,155,158,161,165,166,131,135,140,143,147,150,154,157,160,164', -'169,130,134,139,142,146,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46', -'52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,', -',,50,55,,167,,,,74,5,10,16,19,24,163,,,,45,48,,151,155,158,161,165,166', -'131,135,140,143,147,150,154,157,160,164,169,130,134,139,142,146,,,,72', -'3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,', -',,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,167,,,,74,5,10,16,19', -'24,163,,,,45,48,,151,155,158,161,165,166,131,135,140,143,147,150,154', -'157,160,164,169,130,134,139,142,146,,,,72,3,,,,27,,33,36,12,41,,29,32', -'35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13', -',22,,34,37,,,,50,55,,167,,,,74,5,10,16,19,24,163,,,,45,48,,151,155,158', -'161,165,166,131,135,140,143,147,150,154,157,160,164,169,130,134,139', -'142,146,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,', -',,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,167,', -',,74,5,10,16,19,24,163,,,,45,48,,151,155,158,161,165,166,131,135,140', -'143,147,150,154,157,160,164,169,130,,,,,,,,72,3,,,,27,,33,36,12,41,', -'29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,', -',7,13,,22,,34,37,,,,50,55,,167,,,,74,5,10,16,19,24,163,,,,45,48,,151', -'155,158,161,165,166,131,135,140,143,147,150,154,157,160,164,169,130', -',,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2', -',,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,167,,,,74', -'5,10,16,19,24,163,,,,45,48,,151,155,158,161,165,166,131,135,140,143', -'147,150,154,157,160,164,169,130,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32', -'35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13', -',22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24,163,,,305,45,48,,151,155,158', -'161,165,166,131,135,140,143,147,150,154,157,,,,,,,,,,,,72,3,,,,27,,33', -'36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58', -'66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24,163,,,,45,48', -',151,155,158,161,165,166,131,135,140,143,147,150,154,157,,,,,,,,,,,', -'72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26', -',,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19', -'24,163,,,,45,48,,151,155,158,161,165,166,131,135,140,143,147,150,154', -'157,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65', -',,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,', -',74,5,10,16,19,24,163,,,,45,48,,151,155,158,161,165,166,131,135,163', -',,,,,,151,155,158,161,165,166,131,135,,,72,3,,,,27,,33,36,12,41,,29', -'32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7', -'13,,22,,34,37,,,,50,55,114,,,,,74,5,10,16,19,24,163,,,,45,48,,151,155', -'158,161,165,166,131,135,163,,,,,,,151,155,158,161,165,166,131,135,,', -'72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26', -',,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19', -'24,163,,,,45,48,,151,155,158,161,165,166,131,135,163,,,,,,,151,155,158', -'161,165,166,131,135,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52', -'57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50', -'55,,,,,,74,5,10,16,19,24,163,,,,45,48,163,151,155,158,161,165,166,151', -'155,158,161,165,166,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39', -'43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34', -'37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,', -',,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21', -'26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16', -'19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29', -'32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7', -'13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,', -',,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65', -',,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,', -',74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33', -'36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58', -'66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,', -',,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46', -'52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,', -',,50,55,,124,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,', -',72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26', -',,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,278,,,,,74,5,10,16', -'19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,8,14,,27,,33,36,12,41', -',29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,', -',,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,', -',,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62', -'65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,', -',,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27', -',33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53', -'58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48', -',,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46', -'52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,', -',,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72', -'3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,', -',,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24', -',,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35', -'39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22', -',34,37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,', -',,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,', -',21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10', -'16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41', -',29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,', -',,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,', -',,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62', -'65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,', -',,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27', -',33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53', -'58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48', -',,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46', -'52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,', -',,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72', -'3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,', -',,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24', -',,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35', -'39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22', -',34,37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,', -',,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,', -',21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10', -'16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41', -',29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,', -',,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,', -',,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62', -'65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,', -',,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27', -',33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53', -'58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48', -',,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46', -'52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,', -',,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72', -'3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,', -',,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24', -',,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35', -'39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22', -',34,37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,', -',,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,', -',21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10', -'16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41', -',29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,', -',,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,', -',,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62', -'65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,', -',,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27', -',33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53', -'58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48', -',,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46', -'52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,', -',,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72', -'3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,', -',,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24', -',,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35', -'39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22', -',34,37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,', -',,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,', -',21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10', -'16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41', -',29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,', -',,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,', -',,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62', -'65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,', -',,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27', -',33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53', -'58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48', -',,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46', -'52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,', -',,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72', -'3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,', -',,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24', -',,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35', -'39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22', -',34,37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,', -',,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,', -',21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10', -'16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41', -',29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,', -',,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,', -',,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62', -'65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,114', -',,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27', -',33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53', -'58,66,67,,,,,7,13,,22,,34,37,,,,50,55,60,,,,,74,5,10,16,19,24,,,,,45', -'48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,8,14,,27,,33,36,12,41,,29,32,35,39', -'43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34', -'37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,', -',,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21', -'26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16', -'19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29', -'32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7', -'13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,', -',,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65', -',,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,', -',74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33', -'36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58', -'66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,', -',,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46', -'52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,', -',,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72', -'3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,', -',,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24', -',,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41,,29,32,35', -'39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22', -',34,37,,,,50,55,,,,,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,', -',,,,,,72,3,,,,27,,33,36,12,41,,29,32,35,39,43,46,52,57,62,65,,,,,2,', -',21,26,,,,,42,,,53,58,66,67,,,,,7,13,,22,,34,37,,,,50,55,,,,,,74,5,10', -'16,19,24,,,,,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,12,41', -',29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,', -',,7,13,,22,,34,37,,,,50,55,,136,,144,,74,5,10,16,19,24,,,,,45,48,,,', -',,,,,,,,,,,,,132,137,,,,152,,,,167,72,3,,,,27,,33,36,163,41,,,,,,151', -'155,158,161,165,166,131,135,140,143,147,150,154,157,160,164,169,130', -'134,139,142,146,149,153,156,159,162,168,129,133,138,141,145,148,136', -',144,,,,,,,318,,,,,,,,,,,,,,,,,,,,,,,132,137,,,,152,,,,167,,,,,,,,,', -'163,,,,,,,151,155,158,161,165,166,131,135,140,143,147,150,154,157,160', -'164,169,130,134,139,142,146,149,153,156,159,162,168,129,133,138,141', -'145,148,,,,,,,,,,324,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,', -',42,,,53,58,66,,,,,,,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,19,24,,', -',,,,,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,72,3,53,58', -'66,27,,33,36,,41,13,,22,,34,37,,,,50,55,,,,,,74,5,10,16,29,32,35,39', -'43,46,52,57,62,65,,,,,,,,,,,,,,,,,,58,66,,,,,,72,3,,,,27,,33,36,,41', -'55,,,,,,,,,,,,,,,,,,29,32,35,39,43,46,52,57,62,65,,,,,2,,,21,26,,,,', -'42,,,53,58,66,,,27,,33,36,13,41,22,,34,37,,,,50,55,,,,,,74,5,10,16,19', -'24,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,3,,,,27,,33,36,,41,29,32,35,39', -'43,46,52,57,62,65,,,,,2,,,21,26,,,,,42,,,53,58,66,67,,,,,,13,,22,,34', -'37,,,,50,55,,136,,144,,74,5,10,16,19,24,,,,,45,48,,,,,,,,,,325,,,,,', -',132,137,,,,152,,,,167,72,3,,,,27,,33,36,163,41,,,,,,151,155,158,161', -'165,166,131,135,140,143,147,150,154,157,160,164,169,130,134,139,142', -'146,149,153,156,159,162,168,129,133,138,141,145,148,136,,144,,,,,,,', -',,,,,,,,,,,,,,,,,,,,,,132,137,,,,152,,,,167,,,,,,,,,,163,,,,,,,151,155', -'158,161,165,166,131,135,140,143,147,150,154,157,160,164,169,130,134', -'139,142,146,149,153,156,159,162,168,129,133,138,141,145,148,136,,144', -',,,,,,,,,,,,,,,,,,,,,,,,,,,,,132,137,,,,152,,,,167,,,,,,,,,,163,,,,', -',,151,155,158,161,165,166,131,135,140,143,147,150,154,157,160,164,169', -'130,134,139,142,146,149,153,156,159,162,168,129,133,138,141,145,148', -'136,,144,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,132,137,,,,152,,,,167,,,,,,,,', -',163,,,,,,,151,155,158,161,165,166,131,135,140,143,147,150,154,157,160', -'164,169,130,134,139,142,146,149,153,156,159,162,168,129,133,138,141', -'145,148,136,,144,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,132,137,,,,152,,,,167', -',,,,,,,,,163,,,,,,,151,155,158,161,165,166,131,135,140,143,147,150,154', -'157,160,164,169,130,134,139,142,146,149,153,156,159,162,168,129,133', -'138,141,145,148,136,,144,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,132,137,,,,152', -',,,167,,,,,,,,,,163,,,,,,,151,155,158,161,165,166,131,135,140,143,147', -'150,154,157,160,164,169,130,134,139,142,146,149,153,156,159,162,168', -'129,133,138,141,145,148,136,,144,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,132,137', -',,,152,,,,167,,,,,,,,,,163,,,,,,,151,155,158,161,165,204,131,135,140', -'143,147,150,154,157,160,164,169,130,134,139,142,146,149,153,156,159', -'162,168,129,133,138,141,145,148,136,,144,,,,,,,,,,,,,,,,,,,,,,,,,,,', -',,132,137,,,,152,,,,167,,,,,,,,,,163,,,,,,,151,155,158,161,165,166,131', -'135,140,143,147,150,154,157,160,164,169,130,134,139,142,146,149,153', -'156,159,162,168,129,133,138,141,145,148,136,,144,,,,,,,,,,,,,,,,,,,', -',,,,,,,,,,132,137,,,,152,,,,167,,,,,,,,,,163,,,,,,,151,155,158,161,165', -'166,131,135,140,143,147,150,154,157,160,164,169,130,134,139,142,146', -'149,153,156,159,162,168,129,133,138,141,145,148,136,,144,,,,,,,,,,,', -',,,,,,,,,,,,,,,,,,132,137,,,,152,,,,167,,,,,,,,,,163,,,,,,,151,155,158', -'161,165,166,131,135,140,143,147,150,154,157,160,164,169,130,134,139', -'142,146,149,153,156,159,162,168,129,133,138,141,145,148,136,,144,,,', -',,,,,,,,,,,,,,,,,,,,,,,,,,132,137,,,,152,,,,167,,,,,,,,,,163,,,,,,,151', -'155,158,161,165,166,131,135,140,143,147,150,154,157,160,164,169,130', -'134,139,142,146,149,153,156,159,162,168,129,133,138,141,145,148,136', -',144,,,,,,,,,,,,,,,,,,,,,,,323,,,,,,,132,137,,,,152,,,,167,,,,,,,,,', -'163,,,,,,,151,155,158,161,165,166,131,135,140,143,147,150,154,157,160', -'164,169,130,134,139,142,146,149,153,156,159,162,168,129,133,138,141', -'145,148,136,,144,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,132,137,,,,152,,,,167', -',,,,,,,,,163,,,,,,,151,155,158,161,165,166,131,135,140,143,147,150,154', -'157,160,164,169,130,134,139,142,146,149,153,156,159,162,168,129,133', -'138,141,145,148,136,,144,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,132,137,,,,152', -',,,167,,,,,,,,,,163,,,,,,,151,155,158,161,165,166,131,135,140,143,147', -'150,154,157,160,164,169,130,134,139,142,146,149,153,156,159,162,168', -'129,133,138,141,145,148,136,,144,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,132,137', -',,,152,,,,167,,,,,,,,,,163,,,,,,,151,155,158,161,165,166,131,135,140', -'143,147,150,154,157,160,164,169,130,134,139,142,146,149,153,156,159', -'162,168,129,133,138,141,145,148,136,,144,,,,,,,,,,,,,,,,,,,,,,,,,,,', -',,132,137,,,,152,,,,167,,,,,,,,,,163,,,,,,,151,155,158,161,165,166,131', -'135,140,143,147,150,154,157,160,164,169,130,134,139,142,146,149,153', -'156,159,162,168,129,133,138,141,145,148,136,,144,,,,,,,,,,,,,,,,,,,', -',,,274,,,,,,,132,137,,,,152,,,,167,,,,,,,,,,163,,,,,,,151,155,158,161', -'165,275,131,135,140,143,147,150,154,157,160,164,169,130,134,139,142', -'146,149,153,156,159,162,168,129,133,138,141,145,148,136,,144,,,,,,,', -',,,,,,,,,,,,,,,,,,,,,,132,137,,,,152,,,,167,,,,,,,,,,163,,,,,,,151,155', -'158,161,165,166,131,135,140,143,147,150,154,157,160,164,169,130,134', -'139,142,146,149,153,156,159,162,168,129,133,138,141,145,148,136,,144', -',,,,,,,,,,,,,,,,,,,,,,,,,,,,,132,137,,,,152,,,,167,,,,,,,,185,,163,', -',,,,,151,155,158,161,165,166,131,135,140,143,147,150,154,157,160,164', -'169,130,134,139,142,146,149,153,156,159,162,168,129,133,138,141,145', -'148,136,,144,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,132,137,,,,152,,,,167,,,,', -',,,60,,163,,,,,,,151,155,158,161,165,166,131,135,140,143,147,150,154', -'157,160,164,169,130,134,139,142,146,149,153,156,159,162,168,129,133', -'138,141,145,148,136,,144,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,132,137,,,,152', -',,,167,,,,,,,,,,163,,,,,,,151,155,158,161,165,166,131,135,140,143,147', -'150,154,157,160,164,169,130,134,139,142,146,149,153,156,159,162,168', -'129,133,138,141,145,148,136,,144,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,132,137', -',,,152,,,,167,,,,,,,,60,,163,,,,,,,151,155,158,161,165,166,131,135,140', -'143,147,150,154,157,160,164,169,130,134,139,142,146,149,153,156,159', -'162,168,129,133,138,141,145,148,136,,144,,,,,,,,,,,,,,,,,,,,,,,,,,,', -',,132,137,,,,152,,,,167,,,,,,,,,,163,,,,,,,151,155,158,161,165,166,131', -'135,140,143,147,150,154,157,160,164,169,130,134,139,142,146,149,153', -'156,159,162,168,129,133,138,141,145,148,132,137,,,,,,,,167,,,,,,,,,', -'163,,,,,,,151,155,158,161,165,166,131,135,140,143,147,150,154,157,160', -'164,169,130,134,139,142,146,149,153,156,159,162,168,129,133,138,141', -'145,148,132,137,,,,,,,,167,,,,,,,,,,163,,,,,,,151,155,158,161,165,166', -'131,135,140,143,147,150,154,157,160,164,169,130,134,139,142,146,149', -'153,156,159,162,168,129,133,138,141,145,148,132,137,,,,,,,,167,,,,,', -',,,,163,,,,,,,151,155,158,161,165,166,131,135,140,143,147,150,154,157', -'160,164,169,130,134,139,142,146,149,153,156,159,162,168,129,133,138', -'141,145,148,137,,,,,,,,167,,,,,,,,,,163,,,,,,,151,155,158,161,165,166', -'131,135,140,143,147,150,154,157,160,164,169,130,134,139,142,146,149', -'153,156,159,162,168,129,133,138,141,145,148,137,,,,,,,,167,,,,,,,,,', -'163,,,,,,,151,155,158,161,165,166,131,135,140,143,147,150,154,157,160', -'164,169,130,134,139,142,146,149,153,156,159,162,168,129,133,138,141', -'145,148,137,,,,,,,,167,,,,,,,,,,163,,,,,,,151,155,158,161,165,166,131', -'135,140,143,147,150,154,157,160,164,169,130,134,139,142,146,149,153', -'156,159,162,168,129,133,138,141,145,148,137,,,,,,,,167,,,,,,,,,,163', -',,,,,,151,155,158,161,165,166,131,135,140,143,147,150,154,157,160,164', -'169,130,134,139,142,146,149,153,156,159,162,168,129,133,138,141,145', -'148,137,,,,,,,,167,,,,,,,,,,163,,,,,,,151,155,158,161,165,166,131,135', -'140,143,147,150,154,157,160,164,169,130,134,139,142,146,149,153,156', -'159,162,168,129,133,138,141,145,148,167,,,,,,,,,,163,,,,,,,151,155,158', -'161,165,166,131,135,140,143,147,150,154,157,160,164,169,130,134,139', -'142,146,149,153,156,159,162,168,129,133,138,141,145,148,167,,,,,,,,', -',163,,,,,,,151,155,158,161,165,166,131,135,140,143,147,150,154,157,160', -'164,169,130,134,139,142,146,149,153,156,159,162,168,129,133,138,141', -'145,148,167,,,,,,,,,,163,,,,,,,151,155,158,161,165,166,131,135,140,143', -'147,150,154,157,160,164,169,130,134,139,142,146,149,153,156,159,162', -'168,129,133,138,141,145,148,167,,,,,,,,,,163,,,,,,,151,155,158,161,165', -'166,131,135,140,143,147,150,154,157,160,164,169,130,134,139,142,146', -'149,153,156,159,162,168,129,133,138,141,145,148,167,,,,,,,,,,163,,,', -',,,151,155,158,161,165,166,131,135,140,143,147,150,154,157,160,164,169', -'130,134,139,142,146,149,153,156,159,162,168,129,133,138,141,145,148', -'167,,,,,,,,,,163,,,,,,,151,155,158,161,165,166,131,135,140,143,147,150', -'154,157,160,164,169,130,134,139,142,146,149,153,156,159,162,168,129', -'133,138,141,145,148,167,,,,,,,,,,163,,,,,,,151,155,158,161,165,166,131', -'135,140,143,147,150,154,157,160,164,169,130,134,139,142,146,149,153', -'156,159,162,168,129,133,138,141,145,148,167,,,,,,,,,,163,,,,,,,151,155', -'158,161,165,166,131,135,140,143,147,150,154,157,160,164,169,130,134', -'139,142,146,149,153,156,159,162,168,129,133,138,141,145,148' ] - racc_action_table = arr = Array.new(11148, nil) - idx = 0 - clist.each do |str| - str.split(',', -1).each do |i| - arr[idx] = i.to_i unless i.empty? - idx += 1 - end - end - -clist = [ -'117,113,117,172,172,172,172,172,172,172,172,172,172,175,283,82,89,313', -'313,261,175,175,205,89,89,71,71,71,216,216,172,172,117,117,71,185,71', -'117,220,220,259,117,216,185,275,113,113,113,172,205,252,117,113,182', -'182,33,71,71,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,82,205,205,205,78,172,166,172,172,103,172,117,103,103,103', -'103,103,103,103,103,103,103,299,193,291,291,103,123,95,103,103,81,263', -'192,192,103,27,27,103,103,103,103,192,68,68,27,103,103,282,103,193,103', -'103,78,189,37,103,103,103,262,262,118,118,103,103,103,103,103,103,299', -'263,123,123,103,103,63,63,192,263,120,27,263,27,244,191,191,120,120', -'99,99,244,244,96,191,193,193,193,99,189,189,189,103,103,98,295,75,103', -'180,103,103,302,103,295,302,302,302,302,302,302,302,302,302,302,181', -'192,192,70,302,191,296,302,302,99,42,99,105,302,272,272,302,302,302', -'302,127,127,2,272,302,302,106,302,107,302,302,54,213,209,302,302,208', -'312,91,91,91,302,302,302,302,302,302,91,88,91,302,302,302,250,207,88', -'88,1,272,122,250,250,250,250,250,250,250,250,250,250,250,250,250,250', -'257,257,257,204,132,302,302,126,67,257,302,257,302,302,5,302,,5,5,5', -'5,5,5,5,5,5,5,256,256,256,,5,,,5,5,256,,256,,5,247,,5,5,5,5,,247,247', -',5,5,,5,,5,5,83,,,5,5,,222,83,83,,5,5,5,5,5,5,222,,,,5,5,,222,222,222', -'222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222', -'222,222,,,,5,5,101,101,101,5,101,5,5,7,5,,7,7,7,7,7,7,7,7,7,7,31,31', -'31,,7,,,7,7,31,,31,,7,119,,7,7,7,7,,119,119,,7,7,,7,,7,7,251,,,7,7,', -'234,251,251,,7,7,7,7,7,7,234,,,,7,7,,234,234,234,234,234,234,234,234', -'234,234,234,234,234,234,234,234,234,234,234,234,234,234,,,,7,7,,,,7', -',7,7,10,7,,10,10,10,10,10,10,10,10,10,10,90,90,90,,10,,,10,10,90,,90', -',10,93,,10,10,10,10,,93,93,,10,10,,10,,10,10,85,,,10,10,,242,85,85,', -'10,10,10,10,10,10,242,,,,10,10,,242,242,242,242,242,242,242,242,242', -'242,242,242,242,242,242,242,242,242,242,242,242,242,,,,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,,240,,,,12,12,12,12,12,12,240', -',,,12,12,,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240', -'240,240,240,240,240,240,240,,,,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,,237,,,,13,13,13,13,13,13,237,,,,13,13,,237,237,237', -'237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237,237', -'237,237,,,,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,,227', -',,,16,16,16,16,16,16,227,,,,16,16,,227,227,227,227,227,227,227,227,227', -'227,227,227,227,227,227,227,227,227,227,227,227,227,,,,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,,230,,,,19,19,19,19,19,19,230', -',,,19,19,,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230', -'230,230,230,230,230,230,230,,,,19,19,,,,19,,19,19,290,19,,290,290,290', -'290,290,290,290,290,290,290,,,,,290,,,290,290,,,,,290,,,290,290,290', -'290,,,,,290,290,,290,,290,290,,,,290,290,,245,,,,290,290,290,290,290', -'290,245,,,,290,290,,245,245,245,245,245,245,245,245,245,245,245,245', -'245,245,245,245,245,245,245,245,245,245,,,,290,290,,,,290,,290,290,22', -'290,,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,,253,,,,22,22,22,22,22,22,253,,,,22', -'22,,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253', -'253,253,,,,,,,,22,22,,,,22,,22,22,24,22,,24,24,24,24,24,24,24,24,24', -'24,,,,,24,,,24,24,,,,,24,,,24,24,24,24,,,,,24,24,,24,,24,24,,,,24,24', -',112,,,,24,24,24,24,24,24,112,,,,24,24,,112,112,112,112,112,112,112', -'112,112,112,112,112,112,112,112,112,112,112,,,,,,,,24,24,,,,24,,24,24', -'289,24,,289,289,289,289,289,289,289,289,289,289,,,,,289,,,289,289,,', -',,289,,,289,289,289,289,,,,,289,289,,289,,289,289,,,,289,289,,92,,,', -'289,289,289,289,289,289,92,,,,289,289,,92,92,92,92,92,92,92,92,92,92', -'92,92,92,92,92,92,92,92,,,,,,,,289,289,,,,289,,289,289,280,289,,280', -'280,280,280,280,280,280,280,280,280,,,,,280,,,280,280,,,,,280,,,280', -'280,280,280,,,,,280,280,,280,,280,280,,,,280,280,,,,,,280,280,280,280', -'280,280,255,,,280,280,280,,255,255,255,255,255,255,255,255,255,255,255', -'255,255,255,,,,,,,,,,,,280,280,,,,280,,280,280,278,280,,278,278,278', -'278,278,278,278,278,278,278,,,,,278,,,278,278,,,,,278,,,278,278,278', -'278,,,,,278,278,,278,,278,278,,,,278,278,,,,,,278,278,278,278,278,278', -'218,,,,278,278,,218,218,218,218,218,218,218,218,218,218,218,218,218', -'218,,,,,,,,,,,,278,278,,,,278,,278,278,277,278,,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,246,,', -',277,277,,246,246,246,246,246,246,246,246,246,246,246,246,246,246,,', -',,,,,,,,,277,277,,,,277,,277,277,34,277,,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,241,,,,34,34,,241,241,241,241,241,241,241,241', -'228,,,,,,,228,228,228,228,228,228,228,228,,,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,238,,,,36,36,', -'238,238,238,238,238,238,238,238,243,,,,,,,243,243,243,243,243,243,243', -'243,,,36,36,,,,36,,36,36,264,36,,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,231,,,,264,264,,231,231', -'231,231,231,231,231,231,235,,,,,,,235,235,235,235,235,235,235,235,,', -'264,264,,,,264,,264,264,41,264,,41,41,41,41,41,41,41,41,41,41,,,,,41', -',,41,41,,,,,41,,,41,41,41,41,,,,,41,41,,41,,41,41,,,,41,41,,,,,,41,41', -'41,41,41,41,223,,,,41,41,219,223,223,223,223,223,223,219,219,219,219', -'219,219,,,,,,,,,,,,,,41,41,,,,41,,41,41,215,41,,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,,,,215,,215,215,45,215,,45,45', -'45,45,45,45,45,45,45,45,,,,,45,,,45,45,,,,,45,,,45,45,45,45,,,,,45,45', -',45,,45,45,,,,45,45,,,,,,45,45,45,45,45,45,,,,,45,45,,,,,,,,,,,,,,,', -',,,,,,,,,,,45,45,,,,45,,45,45,48,45,,48,48,48,48,48,48,48,48,48,48,', -',,,48,,,48,48,,,,,48,,,48,48,48,48,,,,,48,48,,48,,48,48,,,,48,48,,,', -',,48,48,48,48,48,48,,,,,48,48,,,,,,,,,,,,,,,,,,,,,,,,,,,48,48,,,,48', -',48,48,53,48,,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,129,53,,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,60', -'129,,60,60,60,60,60,60,60,60,60,60,,,,,60,,,60,60,,,,,60,,,60,60,60', -'60,,,,,60,60,,60,,60,60,,,,60,60,,60,,,,60,60,60,60,60,60,,,,,60,60', -',,,,,,,,,,,,,,,,,,,,,,,,,,60,60,,,,60,,60,60,202,60,,202,202,202,202', -'202,202,202,202,202,202,,,,,202,,,202,202,,,,,202,,,202,202,202,202', -',,,,202,202,,202,,202,202,,,,202,202,202,,,,,202,202,202,202,202,202', -',,,,202,202,,,,,,,,,,,,,,,,,,,,,,,,,,,202,202,202,202,,202,,202,202', -'201,202,,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,188,201,,188,188,188,188,188,188,188,188,188,188,,,,,188', -',,188,188,,,,,188,,,188,188,188,188,,,,,188,188,,188,,188,188,,,,188', -'188,,,,,,188,188,188,188,188,188,,,,,188,188,,,,,,,,,,,,,,,,,,,,,,,', -',,,188,188,,,,188,,188,188,187,188,,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,186,187,,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,173,186', -',173,173,173,173,173,173,173,173,173,173,,,,,173,,,173,173,,,,,173,', -',173,173,173,173,,,,,173,173,,173,,173,173,,,,173,173,,,,,,173,173,173', -'173,173,173,,,,,173,173,,,,,,,,,,,,,,,,,,,,,,,,,,,173,173,,,,173,,173', -'173,74,173,,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,169,74,,169,169,169', -'169,169,169,169,169,169,169,,,,,169,,,169,169,,,,,169,,,169,169,169', -'169,,,,,169,169,,169,,169,169,,,,169,169,,,,,,169,169,169,169,169,169', -',,,,169,169,,,,,,,,,,,,,,,,,,,,,,,,,,,169,169,,,,169,,169,169,168,169', -',168,168,168,168,168,168,168,168,168,168,,,,,168,,,168,168,,,,,168,', -',168,168,168,168,,,,,168,168,,168,,168,168,,,,168,168,,,,,,168,168,168', -'168,168,168,,,,,168,168,,,,,,,,,,,,,,,,,,,,,,,,,,,168,168,,,,168,,168', -'168,167,168,,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,165,167,,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,162,164,,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,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,154,156,,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,150,152,,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,149,150', -',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,146,147,,146,146,146,146,146,146,146', -'146,146,146,,,,,146,,,146,146,,,,,146,,,146,146,146,146,,,,,146,146', -',146,,146,146,,,,146,146,,,,,,146,146,146,146,146,146,,,,,146,146,,', -',,,,,,,,,,,,,,,,,,,,,,,,146,146,,,,146,,146,146,145,146,,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,314,145', -',314,314,314,314,314,314,314,314,314,314,,,,,314,,,314,314,,,,,314,', -',314,314,314,314,,,,,314,314,,314,,314,314,,,,314,314,,,,,,314,314,314', -'314,314,314,,,,,314,314,,,,,,,,,,,,,,,,,,,,,,,,,,,314,314,,,,314,,314', -'314,104,314,,104,104,104,104,104,104,104,104,104,104,,,,,104,,,104,104', -',,,,104,,,104,104,104,104,,,,,104,104,,104,,104,104,,,,104,104,,,,,', -'104,104,104,104,104,104,,,,,104,104,,,,,,,,,,,,,,,,,,,,,,,,,,,104,104', -',,,104,,104,104,144,104,,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,143,144,,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,114,140,,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,139,114,,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,116,139,,116,116,116', -'116,116,116,116,116,116,116,,,,,116,,,116,116,,,,,116,,,116,116,116', -'116,,,,,116,116,,116,,116,116,,,,116,116,116,,,,,116,116,116,116,116', -'116,,,,,116,116,,,,,,,,,,,,,,,,,,,,,,,,,,,116,116,,,,116,,116,116,0', -'116,,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,138,0,,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,137,138,,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,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,125,133,,125,125,125,125,125,125,125,125,125,125,,,', -',125,,,125,125,,,,,125,,,125,125,125,125,,,,,125,125,,125,,125,125,', -',,125,125,,,,,,125,125,125,125,125,125,,,,,125,125,,,,,,,,,,,,,,,,,', -',,,,,,,,,125,125,,,,125,,125,125,131,125,,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,130,131,,130,130,130', -'130,130,130,130,130,130,130,,,,,130,,,130,130,,,,,130,,,130,130,130', -'130,,,,,130,130,,130,,130,130,,,,130,130,,,,,,130,130,130,130,130,130', -',,,,130,130,,,,,,,,,,,,,,,,,,,,,,,,,,,130,130,,,,130,,130,130,214,130', -',214,214,214,214,214,214,214,214,214,214,,,,,214,,,214,214,,,,,214,', -',214,214,214,214,,,,,214,214,,214,,214,214,,,,214,214,,306,,306,,214', -'214,214,214,214,214,,,,,214,214,,,,,,,,,,,,,,,,,306,306,,,,306,,,,306', -'214,214,,,,214,,214,214,306,214,,,,,,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,317,,317,,,,,,,306,,,,,,,,,,,,,', -',,,,,,,,,317,317,,,,317,,,,317,,,,,,,,,,317,,,,,,,317,317,317,317,317', -'317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317', -'317,317,317,317,317,317,317,317,317,317,317,317,,,,,,,,,,317,315,315', -'315,315,315,315,315,315,315,315,,,,,315,,,315,315,,,,,315,,,315,315', -'315,,,,,,,315,,315,,315,315,,,,315,315,,,,,,315,315,315,315,315,315', -',,,,,,,,163,163,163,163,163,163,163,163,163,163,,,,,163,,,163,163,,', -',,163,315,315,163,163,163,315,,315,315,,315,163,,163,,163,163,,,,163', -'163,,,,,,163,163,163,163,21,21,21,21,21,21,21,21,21,21,,,,,,,,,,,,,', -',,,,21,21,,,,,,163,163,,,,163,,163,163,,163,21,,,,,,,,,,,,,,,,,,305', -'305,305,305,305,305,305,305,305,305,,,,,305,,,305,305,,,,,305,,,305', -'305,305,,,21,,21,21,305,21,305,,305,305,,,,305,305,,,,,,305,305,305', -'305,305,305,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,305,305,,,,305,,305,305', -',305,26,26,26,26,26,26,26,26,26,26,,,,,26,,,26,26,,,,,26,,,26,26,26', -'26,,,,,,26,,26,,26,26,,,,26,26,,322,,322,,26,26,26,26,26,26,,,,,26,26', -',,,,,,,,,322,,,,,,,322,322,,,,322,,,,322,26,26,,,,26,,26,26,322,26,', -',,,,322,322,322,322,322,322,322,322,322,322,322,322,322,322,322,322', -'322,322,322,322,322,322,322,322,322,322,322,322,322,322,322,322,322', -'322,69,,69,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,69,69,,,,69,,,,69,,,,,,,,,,69', -',,,,,,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69', -'69,69,69,69,69,69,69,69,69,69,69,69,69,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,212,212,212,304,,304,,,,,,,,,,,', -',,,,,,,,,,,,,,,,,,304,304,,,,304,,,,304,,,,,,,,,,304,,,,,,,304,304,304', -'304,304,304,304,304,304,304,304,304,304,304,304,304,304,304,304,304', -'304,304,304,304,304,304,304,304,304,304,304,304,304,304,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,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,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,115,115,203,,203,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,203,203,,,,203,,,', -'203,,,,,,,,,,203,,,,,,,203,203,203,203,203,203,203,203,203,203,203,203', -'203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203', -'203,203,203,203,203,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,224,224,224,224,224,224,232,,232,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,232', -'232,,,,232,,,,232,,,,,,,,,,232,,,,,,,232,232,232,232,232,232,232,232', -'232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232,232', -'232,232,232,232,232,232,232,232,232,279,,279,,,,,,,,,,,,,,,,,,,,,,,', -',,,,,,279,279,,,,279,,,,279,,,,,,,,,,279,,,,,,,279,279,279,279,279,279', -'279,279,279,279,279,279,279,279,279,279,279,279,279,279,279,279,279', -'279,279,279,279,279,279,279,279,279,279,279,316,,316,,,,,,,,,,,,,,,', -',,,,,,,316,,,,,,,316,316,,,,316,,,,316,,,,,,,,,,316,,,,,,,316,316,316', -'316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,316', -'316,316,316,316,316,316,316,316,316,316,316,316,316,316,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,268', -',268,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,268,268,,,,268,,,,268,,,,,,,,,,268', -',,,,,,268,268,268,268,268,268,268,268,268,268,268,268,268,268,268,268', -'268,268,268,268,268,268,268,268,268,268,268,268,268,268,268,268,268', -'268,267,,267,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,267,267,,,,267,,,,267,,,,', -',,,,,267,,,,,,,267,267,267,267,267,267,267,267,267,267,267,267,267,267', -'267,267,267,267,267,267,267,267,267,267,267,267,267,267,267,267,267', -'267,267,267,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,266,266', -'266,266,266,266,266,195,,195,,,,,,,,,,,,,,,,,,,,,,,195,,,,,,,195,195', -',,,195,,,,195,,,,,,,,,,195,,,,,,,195,195,195,195,195,195,195,195,195', -'195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195', -'195,195,195,195,195,195,195,195,321,,321,,,,,,,,,,,,,,,,,,,,,,,,,,,', -',,321,321,,,,321,,,,321,,,,,,,,,,321,,,,,,,321,321,321,321,321,321,321', -'321,321,321,321,321,321,321,321,321,321,321,321,321,321,321,321,321', -'321,321,321,321,321,321,321,321,321,321,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,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,239,,239,,,,,,,,,,,', -',,,,,,,,,,,,,,,,,,239,239,,,,239,,,,239,,,,,,,,,,239,,,,,,,239,239,239', -'239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239', -'239,239,239,239,239,239,239,239,239,239,239,239,239,239,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,194,,194,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,194', -'194,,,,194,,,,194,,,,,,,,,,194,,,,,,,194,194,194,194,194,194,194,194', -'194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194,194', -'194,194,194,194,194,194,194,194,194,258,258,,,,,,,,258,,,,,,,,,,258', -',,,,,,258,258,258,258,258,258,258,258,258,258,258,258,258,258,258,258', -'258,258,258,258,258,258,258,258,258,258,258,258,258,258,258,258,258', -'258,121,121,,,,,,,,121,,,,,,,,,,121,,,,,,,121,121,121,121,121,121,121', -'121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121', -'121,121,121,121,121,121,121,121,121,121,94,94,,,,,,,,94,,,,,,,,,,94', -',,,,,,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94', -'94,94,94,94,94,94,94,94,94,94,94,94,94,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,286,286,286', -'286,310,,,,,,,,310,,,,,,,,,,310,,,,,,,310,310,310,310,310,310,310,310', -'310,310,310,310,310,310,310,310,310,310,310,310,310,310,310,310,310', -'310,310,310,310,310,310,310,310,310,309,,,,,,,,309,,,,,,,,,,309,,,,', -',,309,309,309,309,309,309,309,309,309,309,309,309,309,309,309,309,309', -'309,309,309,309,309,309,309,309,309,309,309,309,309,309,309,309,309', -'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,287,287,287,287,225,,,,,,,,225,,,,,,,,,,225,,,,,,,225', -'225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225', -'225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,233', -',,,,,,,,,233,,,,,,,233,233,233,233,233,233,233,233,233,233,233,233,233', -'233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233', -'233,233,233,233,217,,,,,,,,,,217,,,,,,,217,217,217,217,217,217,217,217', -'217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,217', -'217,217,217,217,217,217,217,217,217,226,,,,,,,,,,226,,,,,,,226,226,226', -'226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226', -'226,226,226,226,226,226,226,226,226,226,226,226,226,226,229,,,,,,,,', -',229,,,,,,,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229', -'229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229,229', -'229,229,221,,,,,,,,,,221,,,,,,,221,221,221,221,221,221,221,221,221,221', -'221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221', -'221,221,221,221,221,221,221,254,,,,,,,,,,254,,,,,,,254,254,254,254,254', -'254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254', -'254,254,254,254,254,254,254,254,254,254,254,254,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', -'248,,,,,,,,,,248,,,,,,,248,248,248,248,248,248,248,248,248,248,248,248', -'248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248', -'248,248,248,248,248' ] - racc_action_check = arr = Array.new(11148, nil) - idx = 0 - clist.each do |str| - str.split(',', -1).each do |i| - arr[idx] = i.to_i unless i.empty? - idx += 1 - end - end - -racc_action_pointer = [ - 6563, 269, 217, nil, nil, 301, nil, 402, nil, nil, - 503, nil, 604, 705, nil, nil, 806, nil, nil, 907, - nil, 7934, 1109, nil, 1210, nil, 8097, 123, nil, nil, - nil, 402, nil, 41, 1715, nil, 1816, 123, nil, nil, - nil, 2018, 174, nil, nil, 2220, nil, nil, 2321, nil, - nil, nil, nil, 2422, 246, nil, nil, nil, nil, nil, - 2624, nil, nil, 71, nil, nil, nil, 283, 39, 8239, - 167, 10, nil, nil, 3331, 194, nil, nil, 94, nil, - nil, 58, -6, 294, 10079, 496, 9895, 9803, 210, -37, - 503, 238, 1320, 479, 10351, 73, 137, nil, 148, 175, - nil, 301, nil, 99, 5654, 213, 227, 229, nil, nil, - nil, nil, 1219, -51, 6260, 8699, 6462, -2, 124, 378, - 118, 10291, 274, 67, nil, 7270, 198, 200, nil, 2523, - 7472, 7371, 279, 7169, 7068, 6967, 6866, 6765, 6664, 6361, - 6159, 6058, 5957, 5856, 5755, 5452, 5351, 5250, 5149, 5048, - 4947, nil, 4846, 4745, 4644, nil, 4543, 4442, 4341, 4240, - 4139, 4038, 3937, 7879, 3836, 3735, 33, 3634, 3533, 3432, - nil, nil, -2, 3230, nil, -40, nil, nil, nil, nil, - 134, 195, -41, nil, nil, -6, 3129, 3028, 2927, 94, - nil, 171, 120, 90, 10171, 9619, nil, nil, nil, nil, - nil, 2826, 2725, 8791, 227, -3, nil, 239, 237, 197, - nil, nil, 8331, 233, 7573, 2119, -9, 10748, 1522, 2033, - 3, 10901, 310, 2027, 8883, 10646, 10799, 815, 1739, 10850, - 916, 1926, 8975, 10697, 411, 1941, 11003, 714, 1825, 9987, - 613, 1724, 512, 1840, 122, 1017, 1623, 277, 11054, nil, - 215, 395, -15, 1118, 10952, 1421, 301, 274, 10231, -25, - nil, -32, 55, 121, 1917, nil, 9527, 9435, 9343, nil, - nil, nil, 224, nil, nil, -21, 9251, 1614, 1513, 9067, - 1412, nil, 89, -37, nil, nil, 10410, 10587, nil, 1311, - 1008, 79, nil, nil, nil, 155, 170, nil, nil, 63, - 8607, nil, 200, 8515, 8423, 7997, 7623, nil, nil, 10528, - 10469, nil, 200, -79, 5553, 7814, 9159, 7715, nil, nil, - nil, 9711, 8147, nil, nil, nil ] - -racc_action_default = [ - -1, -179, -186, -98, -10, -186, -106, -186, -26, -11, - -186, -107, -186, -186, -27, -12, -186, -108, -13, -186, - -109, -186, -186, -14, -186, -110, -46, -120, -15, -28, - -16, -126, -29, -134, -186, -31, -141, -186, -17, -34, - -18, -186, -186, -35, -19, -186, -36, -20, -186, -128, - -47, -21, -37, -186, -186, -30, -22, -38, -32, -2, - -186, -23, -39, -3, -105, -104, -33, -186, -186, -5, - -186, -8, -97, -9, -186, -179, -181, -183, -186, -177, - -99, -101, -186, -48, -158, -49, -186, -186, -53, -55, - -186, -127, -56, -54, -45, -186, -186, -44, -186, -120, - -121, -186, -131, -141, -186, -186, -186, -186, -112, -116, - -117, -135, -57, -186, -186, -142, -141, -186, -186, -51, - -50, -155, -186, -186, -25, -7, -162, -186, -4, -186, - -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, - -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, - -186, -59, -186, -186, -186, -58, -186, -186, -186, -186, - -186, -186, -186, -94, -186, -186, -186, -186, -186, -186, - -96, -130, -186, -186, -111, -52, -182, -178, -180, -176, - -186, -186, -186, -157, -175, -186, -186, -186, -186, -186, - -119, -186, -186, -186, -142, -186, -113, -114, -115, -140, - -148, -186, -186, -143, -186, -186, -156, -151, -186, -186, - 326, -24, -6, -186, -186, -186, -186, -86, -74, -63, - -186, -87, -75, -64, -184, -93, -88, -76, -65, -89, - -77, -66, -185, -90, -78, -67, -91, -79, -68, -159, - -80, -69, -81, -70, -60, -82, -71, -61, -84, -83, - -72, -62, -186, -92, -85, -73, -129, -186, -40, -186, - -100, -186, -186, -186, -186, -170, -41, -43, -42, -125, - -123, -122, -186, -132, -118, -186, -145, -186, -186, -144, - -186, -133, -186, -186, -152, -163, -164, -165, -161, -186, - -186, -160, -103, -102, -95, -186, -186, -171, -168, -186, - -149, -124, -186, -146, -147, -103, -186, -153, -154, -167, - -166, -174, -186, -172, -186, -103, -186, -186, -136, -169, - -173, -150, -186, -138, -137, -139 ] - -racc_goto_table = [ - 59, 83, 174, 84, 265, 171, 85, 80, 86, 87, - 68, 90, 88, 97, 216, 89, 91, 113, 92, 76, - 93, 174, 94, 101, 171, 270, 271, 127, 79, 63, - 112, 54, 115, 299, 263, 207, 179, 117, 261, 75, - 82, 119, 77, nil, 120, nil, nil, nil, nil, 121, - nil, nil, 118, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, 125, nil, nil, nil, nil, 128, nil, - 175, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 170, nil, 297, nil, 193, 97, nil, nil, 178, 123, - nil, nil, 220, 176, 183, 189, 184, 205, nil, 194, - 195, 191, 177, nil, nil, nil, 301, 291, nil, nil, - 203, nil, 194, nil, 311, nil, nil, nil, nil, nil, - nil, 212, nil, 125, nil, 217, 218, 219, nil, 221, - 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, - 232, 233, 234, 235, 236, 237, 238, nil, 239, 240, - 241, nil, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 256, 253, 254, 255, nil, 257, nil, 258, - nil, 262, nil, nil, nil, nil, nil, 97, 97, nil, - nil, nil, 266, 267, 268, nil, 260, 174, nil, 191, - 171, nil, 272, nil, nil, nil, nil, 276, 279, nil, - nil, nil, 277, nil, nil, nil, nil, nil, nil, nil, - 286, 287, nil, nil, nil, nil, nil, nil, nil, 284, - nil, nil, nil, nil, nil, nil, 288, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, 262, - nil, nil, nil, nil, nil, nil, nil, nil, 97, nil, - 300, nil, 295, nil, nil, nil, nil, nil, nil, nil, - nil, 294, nil, 303, 304, nil, 306, nil, nil, nil, - nil, 262, nil, nil, nil, 309, 310, nil, nil, nil, - nil, nil, 307, 308, nil, nil, nil, nil, 316, nil, - nil, 317, nil, nil, nil, nil, 312, nil, nil, 313, - 321, 322, nil, 320 ] - -racc_goto_check = [ - 2, 5, 32, 5, 45, 38, 5, 26, 5, 5, - 4, 6, 5, 21, 43, 5, 33, 39, 5, 49, - 5, 32, 5, 36, 38, 23, 23, 42, 47, 3, - 5, 1, 5, 40, 44, 41, 46, 5, 25, 48, - 24, 5, 50, nil, 5, nil, nil, nil, nil, 5, - nil, nil, 4, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, 2, nil, nil, nil, nil, 2, nil, - 5, nil, nil, nil, nil, nil, nil, nil, nil, nil, - 4, nil, 45, nil, 39, 21, nil, nil, 4, 3, - nil, nil, 42, 49, 4, 36, 4, 39, nil, 5, - 5, 2, 47, nil, nil, nil, 23, 43, nil, nil, - 5, nil, 5, nil, 45, nil, nil, nil, nil, nil, - nil, 5, nil, 2, nil, 5, 5, 5, nil, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, nil, 5, 5, - 5, nil, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 6, 5, 5, 5, nil, 33, nil, 5, - nil, 21, nil, nil, nil, nil, nil, 21, 21, nil, - nil, nil, 5, 5, 5, nil, 26, 32, nil, 2, - 38, nil, 2, nil, nil, nil, nil, 5, 5, nil, - nil, nil, 2, nil, nil, nil, nil, nil, nil, nil, - 5, 5, nil, nil, nil, nil, nil, nil, nil, 4, - nil, nil, nil, nil, nil, nil, 4, 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, nil, nil, nil, nil, 21, nil, - 5, nil, 2, nil, nil, nil, nil, nil, nil, nil, - nil, 4, nil, 5, 5, nil, 5, nil, nil, nil, - nil, 21, nil, nil, nil, 5, 5, nil, nil, nil, - nil, nil, 4, 4, nil, nil, nil, nil, 5, nil, - nil, 5, nil, nil, nil, nil, 4, nil, nil, 4, - 5, 5, nil, 2 ] - -racc_goto_pointer = [ - nil, 31, 0, 29, 10, -4, -10, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, -14, nil, -166, 38, -144, 5, nil, nil, nil, - nil, nil, -69, -5, nil, nil, -4, nil, -66, -19, - -231, -83, -40, -113, -151, -181, -42, 27, 38, 18, - 41 ] - -racc_goto_default = [ - nil, nil, 201, nil, nil, 69, 71, 73, 4, 9, - 15, 18, 23, 28, 30, 38, 40, 44, 47, 51, - 56, 61, 64, 100, nil, 70, nil, 6, 11, 17, - 20, 25, 108, 31, 109, 110, nil, 49, 102, nil, - nil, nil, nil, nil, nil, nil, 1, nil, nil, nil, - nil ] - -racc_reduce_table = [ - 0, 0, :racc_error, - 0, 107, :_reduce_1, - 1, 107, :_reduce_2, - 1, 107, :_reduce_3, - 2, 107, :_reduce_4, - 1, 109, :_reduce_5, - 3, 109, :_reduce_6, - 2, 109, :_reduce_7, - 1, 111, :_reduce_none, - 1, 111, :_reduce_none, - 1, 111, :_reduce_none, - 1, 111, :_reduce_none, - 1, 111, :_reduce_none, - 1, 111, :_reduce_none, - 1, 111, :_reduce_none, - 1, 111, :_reduce_none, - 1, 111, :_reduce_none, - 1, 111, :_reduce_none, - 1, 111, :_reduce_none, - 1, 111, :_reduce_none, - 1, 111, :_reduce_none, - 1, 111, :_reduce_none, - 1, 111, :_reduce_none, - 1, 111, :_reduce_none, - 3, 110, :_reduce_24, - 2, 110, :_reduce_25, - 1, 108, :_reduce_none, - 1, 108, :_reduce_none, - 1, 128, :_reduce_28, - 1, 128, :_reduce_29, - 1, 128, :_reduce_30, - 1, 128, :_reduce_31, - 1, 128, :_reduce_32, - 1, 128, :_reduce_33, - 1, 128, :_reduce_34, - 1, 128, :_reduce_35, - 1, 128, :_reduce_36, - 1, 128, :_reduce_37, - 1, 128, :_reduce_38, - 1, 128, :_reduce_39, - 3, 116, :_reduce_40, - 3, 129, :_reduce_41, - 3, 129, :_reduce_42, - 3, 129, :_reduce_43, - 1, 129, :_reduce_44, - 2, 120, :_reduce_45, - 1, 120, :_reduce_46, - 1, 127, :_reduce_47, - 2, 115, :_reduce_48, - 2, 115, :_reduce_49, - 2, 115, :_reduce_50, - 2, 115, :_reduce_51, - 2, 115, :_reduce_52, - 2, 115, :_reduce_53, - 2, 115, :_reduce_54, - 2, 115, :_reduce_55, - 2, 115, :_reduce_56, - 2, 115, :_reduce_57, - 2, 115, :_reduce_58, - 2, 115, :_reduce_59, - 3, 115, :_reduce_60, - 3, 115, :_reduce_61, - 3, 115, :_reduce_62, - 3, 115, :_reduce_63, - 3, 115, :_reduce_64, - 3, 115, :_reduce_65, - 3, 115, :_reduce_66, - 3, 115, :_reduce_67, - 3, 115, :_reduce_68, - 3, 115, :_reduce_69, - 3, 115, :_reduce_70, - 3, 115, :_reduce_71, - 3, 115, :_reduce_72, - 3, 115, :_reduce_73, - 3, 115, :_reduce_74, - 3, 115, :_reduce_75, - 3, 115, :_reduce_76, - 3, 115, :_reduce_77, - 3, 115, :_reduce_78, - 3, 115, :_reduce_79, - 3, 115, :_reduce_80, - 3, 115, :_reduce_81, - 3, 115, :_reduce_82, - 3, 115, :_reduce_83, - 3, 115, :_reduce_84, - 3, 115, :_reduce_85, - 3, 115, :_reduce_86, - 3, 115, :_reduce_87, - 3, 115, :_reduce_88, - 3, 115, :_reduce_89, - 3, 115, :_reduce_90, - 3, 115, :_reduce_91, - 3, 115, :_reduce_92, - 3, 115, :_reduce_93, - 2, 126, :_reduce_94, - 5, 114, :_reduce_95, - 2, 114, :_reduce_96, - 1, 131, :_reduce_97, - 1, 131, :_reduce_98, - 1, 130, :_reduce_99, - 3, 130, :_reduce_100, - 1, 132, :_reduce_none, - 4, 132, :_reduce_102, - 4, 125, :_reduce_103, - 1, 112, :_reduce_104, - 1, 112, :_reduce_105, - 1, 112, :_reduce_106, - 1, 112, :_reduce_107, - 1, 112, :_reduce_108, - 1, 112, :_reduce_109, - 1, 112, :_reduce_110, - 2, 112, :_reduce_111, - 2, 112, :_reduce_112, - 2, 138, :_reduce_113, - 2, 138, :_reduce_114, - 2, 138, :_reduce_115, - 1, 138, :_reduce_116, - 1, 138, :_reduce_117, - 3, 140, :_reduce_118, - 3, 134, :_reduce_119, - 0, 142, :_reduce_120, - 1, 142, :_reduce_121, - 3, 142, :_reduce_122, - 3, 142, :_reduce_123, - 4, 142, :_reduce_124, - 3, 142, :_reduce_125, - 1, 113, :_reduce_126, - 2, 113, :_reduce_127, - 1, 113, :_reduce_128, - 3, 124, :_reduce_129, - 2, 139, :_reduce_130, - 2, 139, :_reduce_131, - 3, 144, :_reduce_132, - 4, 143, :_reduce_133, - 1, 137, :_reduce_134, - 2, 137, :_reduce_135, - 6, 136, :_reduce_136, - 7, 136, :_reduce_137, - 6, 141, :_reduce_138, - 7, 141, :_reduce_139, - 3, 133, :_reduce_140, - 0, 145, :_reduce_141, - 1, 145, :_reduce_142, - 2, 145, :_reduce_143, - 3, 145, :_reduce_144, - 3, 145, :_reduce_145, - 4, 145, :_reduce_146, - 4, 145, :_reduce_147, - 2, 145, :_reduce_148, - 1, 146, :_reduce_149, - 3, 146, :_reduce_150, - 3, 118, :_reduce_151, - 4, 118, :_reduce_152, - 5, 118, :_reduce_153, - 3, 147, :_reduce_154, - 2, 119, :_reduce_155, - 3, 135, :_reduce_156, - 3, 121, :_reduce_157, - 2, 121, :_reduce_158, - 3, 121, :_reduce_159, - 4, 122, :_reduce_160, - 4, 122, :_reduce_161, - 1, 148, :_reduce_162, - 3, 148, :_reduce_163, - 2, 149, :_reduce_164, - 2, 149, :_reduce_165, - 3, 149, :_reduce_166, - 3, 149, :_reduce_167, - 5, 123, :_reduce_168, - 7, 123, :_reduce_169, - 1, 150, :_reduce_170, - 2, 150, :_reduce_171, - 3, 151, :_reduce_172, - 4, 151, :_reduce_173, - 3, 151, :_reduce_174, - 3, 152, :_reduce_175, - 2, 153, :_reduce_176, - 1, 154, :_reduce_177, - 2, 154, :_reduce_178, - 0, 155, :_reduce_179, - 2, 155, :_reduce_180, - 1, 156, :_reduce_181, - 2, 156, :_reduce_182, - 2, 117, :_reduce_183, - 3, 117, :_reduce_184, - 3, 117, :_reduce_185 ] - -racc_reduce_n = 186 - -racc_shift_n = 326 - -racc_token_table = { - false => 0, - :error => 1, - :IF => 2, - :ELSE => 3, - :UNLESS => 4, - :NUMBER => 5, - :STRING => 6, - :REGEX => 7, - :TRUE => 8, - :FALSE => 9, - :YES => 10, - :NO => 11, - :ON => 12, - :OFF => 13, - :IDENTIFIER => 14, - :PROPERTY_ACCESS => 15, - :PROTOTYPE_ACCESS => 16, - :SOAK_ACCESS => 17, - :CODE => 18, - :PARAM_START => 19, - :PARAM => 20, - :PARAM_END => 21, - :NEW => 22, - :RETURN => 23, - :CALL_START => 24, - :CALL_END => 25, - :INDEX_START => 26, - :INDEX_END => 27, - :TRY => 28, - :CATCH => 29, - :FINALLY => 30, - :THROW => 31, - :BREAK => 32, - :CONTINUE => 33, - :FOR => 34, - :IN => 35, - :OF => 36, - :BY => 37, - :WHEN => 38, - :WHILE => 39, - :SWITCH => 40, - :LEADING_WHEN => 41, - :DELETE => 42, - :INSTANCEOF => 43, - :TYPEOF => 44, - :SUPER => 45, - :EXTENDS => 46, - :ASSIGN => 47, - :NEWLINE => 48, - :COMMENT => 49, - :JS => 50, - :INDENT => 51, - :OUTDENT => 52, - "?" => 53, - :UMINUS => 54, - :UPLUS => 55, - :NOT => 56, - "!" => 57, - "!!" => 58, - "~" => 59, - "++" => 60, - "--" => 61, - "*" => 62, - "/" => 63, - "%" => 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, - ";" => 97, - "," => 98, - "{" => 99, - "}" => 100, - "@" => 101, - "[" => 102, - "]" => 103, - "(" => 104, - ")" => 105 } - -racc_nt_base = 106 - -racc_use_result_var = true - -Racc_arg = [ - racc_action_table, - racc_action_check, - racc_action_default, - racc_action_pointer, - racc_goto_table, - racc_goto_check, - racc_goto_default, - racc_goto_pointer, - racc_nt_base, - racc_reduce_table, - racc_token_table, - racc_shift_n, - racc_reduce_n, - racc_use_result_var ] - -Racc_token_to_s_table = [ - "$end", - "error", - "IF", - "ELSE", - "UNLESS", - "NUMBER", - "STRING", - "REGEX", - "TRUE", - "FALSE", - "YES", - "NO", - "ON", - "OFF", - "IDENTIFIER", - "PROPERTY_ACCESS", - "PROTOTYPE_ACCESS", - "SOAK_ACCESS", - "CODE", - "PARAM_START", - "PARAM", - "PARAM_END", - "NEW", - "RETURN", - "CALL_START", - "CALL_END", - "INDEX_START", - "INDEX_END", - "TRY", - "CATCH", - "FINALLY", - "THROW", - "BREAK", - "CONTINUE", - "FOR", - "IN", - "OF", - "BY", - "WHEN", - "WHILE", - "SWITCH", - "LEADING_WHEN", - "DELETE", - "INSTANCEOF", - "TYPEOF", - "SUPER", - "EXTENDS", - "ASSIGN", - "NEWLINE", - "COMMENT", - "JS", - "INDENT", - "OUTDENT", - "\"?\"", - "UMINUS", - "UPLUS", - "NOT", - "\"!\"", - "\"!!\"", - "\"~\"", - "\"++\"", - "\"--\"", - "\"*\"", - "\"/\"", - "\"%\"", - "\".\"", - "\"+\"", - "\"-\"", - "\"<<\"", - "\">>\"", - "\">>>\"", - "\"&\"", - "\"|\"", - "\"^\"", - "\"<=\"", - "\"<\"", - "\">\"", - "\">=\"", - "\"==\"", - "\"!=\"", - "IS", - "ISNT", - "\"&&\"", - "\"||\"", - "AND", - "OR", - "\"-=\"", - "\"+=\"", - "\"/=\"", - "\"*=\"", - "\"%=\"", - "\"||=\"", - "\"&&=\"", - "\"?=\"", - "\"->\"", - "\"=>\"", - "\"\\n\"", - "\";\"", - "\",\"", - "\"{\"", - "\"}\"", - "\"@\"", - "\"[\"", - "\"]\"", - "\"(\"", - "\")\"", - "$start", - "Root", - "Terminator", - "Expressions", - "Block", - "Expression", - "Value", - "Call", - "Code", - "Operation", - "Assign", - "If", - "Try", - "Throw", - "Return", - "While", - "For", - "Switch", - "Extends", - "Splat", - "Existence", - "Comment", - "Literal", - "AssignObj", - "ParamList", - "FuncGlyph", - "Param", - "Array", - "Object", - "Parenthetical", - "Range", - "This", - "Accessor", - "Invocation", - "Index", - "Slice", - "AssignList", - "Super", - "Arguments", - "ArgList", - "SimpleArgs", - "Catch", - "ForVariables", - "ForSource", - "Whens", - "When", - "IfBlock", - "ElsIf", - "ElsIfs", - "ElseBody", - "IfEnd" ] - -Racc_debug_parser = false - -##### State transition tables end ##### - -# reduce 0 omitted - -module_eval(<<'.,.,', 'grammar.y', 46) - def _reduce_1(val, _values, result) - result = Expressions.new - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 47) - def _reduce_2(val, _values, result) - result = Expressions.new - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 48) - def _reduce_3(val, _values, result) - result = val[0] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 49) - def _reduce_4(val, _values, result) - result = val[0] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 54) - def _reduce_5(val, _values, result) - result = Expressions.wrap(val) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 55) - def _reduce_6(val, _values, result) - result = val[0] << val[2] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 56) - def _reduce_7(val, _values, result) - result = val[0] - result - end -.,., - -# reduce 8 omitted - -# reduce 9 omitted - -# reduce 10 omitted - -# reduce 11 omitted - -# reduce 12 omitted - -# reduce 13 omitted - -# reduce 14 omitted - -# reduce 15 omitted - -# reduce 16 omitted - -# reduce 17 omitted - -# reduce 18 omitted - -# reduce 19 omitted - -# reduce 20 omitted - -# reduce 21 omitted - -# reduce 22 omitted - -# reduce 23 omitted - -module_eval(<<'.,.,', 'grammar.y', 83) - def _reduce_24(val, _values, result) - result = val[1] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 84) - def _reduce_25(val, _values, result) - result = Expressions.new - result - end -.,., - -# reduce 26 omitted - -# reduce 27 omitted - -module_eval(<<'.,.,', 'grammar.y', 95) - def _reduce_28(val, _values, result) - result = LiteralNode.new(val[0]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 96) - def _reduce_29(val, _values, result) - result = LiteralNode.new(val[0]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 97) - def _reduce_30(val, _values, result) - result = LiteralNode.new(val[0]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 98) - def _reduce_31(val, _values, result) - result = LiteralNode.new(val[0]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 99) - def _reduce_32(val, _values, result) - result = LiteralNode.new(val[0]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 100) - def _reduce_33(val, _values, result) - result = LiteralNode.new(val[0]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 101) - def _reduce_34(val, _values, result) - result = LiteralNode.new(Value.new(true)) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 102) - def _reduce_35(val, _values, result) - result = LiteralNode.new(Value.new(false)) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 103) - def _reduce_36(val, _values, result) - result = LiteralNode.new(Value.new(true)) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 104) - def _reduce_37(val, _values, result) - result = LiteralNode.new(Value.new(false)) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 105) - def _reduce_38(val, _values, result) - result = LiteralNode.new(Value.new(true)) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 106) - def _reduce_39(val, _values, result) - result = LiteralNode.new(Value.new(false)) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 111) - def _reduce_40(val, _values, result) - result = AssignNode.new(val[0], val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 116) - def _reduce_41(val, _values, result) - result = AssignNode.new(ValueNode.new(val[0]), val[2], :object) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 117) - def _reduce_42(val, _values, result) - result = AssignNode.new(ValueNode.new(LiteralNode.new(val[0])), val[2], :object) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 118) - def _reduce_43(val, _values, result) - result = AssignNode.new(ValueNode.new(LiteralNode.new(val[0])), val[2], :object) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 119) - def _reduce_44(val, _values, result) - result = val[0] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 124) - def _reduce_45(val, _values, result) - result = ReturnNode.new(val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 125) - def _reduce_46(val, _values, result) - result = ReturnNode.new(ValueNode.new(Value.new('null'))) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 130) - def _reduce_47(val, _values, result) - result = CommentNode.new(val[0]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 137) - def _reduce_48(val, _values, result) - result = OpNode.new(val[0], val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 138) - def _reduce_49(val, _values, result) - result = OpNode.new(val[0], val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 139) - def _reduce_50(val, _values, result) - result = OpNode.new(val[0], val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 140) - def _reduce_51(val, _values, result) - result = OpNode.new(val[0], val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 141) - def _reduce_52(val, _values, result) - result = OpNode.new(val[0], val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 142) - def _reduce_53(val, _values, result) - result = OpNode.new(val[0], val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 143) - def _reduce_54(val, _values, result) - result = OpNode.new(val[0], val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 144) - def _reduce_55(val, _values, result) - result = OpNode.new(val[0], val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 145) - def _reduce_56(val, _values, result) - result = OpNode.new(val[0], val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 146) - def _reduce_57(val, _values, result) - result = OpNode.new(val[0], val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 147) - def _reduce_58(val, _values, result) - result = OpNode.new(val[1], val[0], nil, true) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 148) - def _reduce_59(val, _values, result) - result = OpNode.new(val[1], val[0], nil, true) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 150) - def _reduce_60(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 151) - def _reduce_61(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -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', 154) - def _reduce_63(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -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', 157) - def _reduce_65(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 158) - def _reduce_66(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -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', 161) - def _reduce_68(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 162) - def _reduce_69(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -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', 165) - def _reduce_71(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 166) - def _reduce_72(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 167) - def _reduce_73(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -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', 170) - def _reduce_75(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 171) - def _reduce_76(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 172) - def _reduce_77(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -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', 175) - def _reduce_79(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 176) - def _reduce_80(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 177) - def _reduce_81(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 178) - def _reduce_82(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -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', 181) - def _reduce_84(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 182) - def _reduce_85(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 183) - def _reduce_86(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 184) - def _reduce_87(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 185) - def _reduce_88(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 186) - def _reduce_89(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 187) - def _reduce_90(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -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', 190) - def _reduce_92(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 191) - def _reduce_93(val, _values, result) - result = OpNode.new(val[1], val[0], val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 196) - def _reduce_94(val, _values, result) - result = ExistenceNode.new(val[0]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 202) - def _reduce_95(val, _values, result) - result = CodeNode.new(val[1], val[4], val[3]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 203) - def _reduce_96(val, _values, result) - result = CodeNode.new([], val[1], val[0]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 208) - def _reduce_97(val, _values, result) - result = :func - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 209) - def _reduce_98(val, _values, result) - result = :boundfunc - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 214) - def _reduce_99(val, _values, result) - result = val - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 215) - def _reduce_100(val, _values, result) - result = val[0] << val[2] - result - end -.,., - -# reduce 101 omitted - -module_eval(<<'.,.,', 'grammar.y', 221) - def _reduce_102(val, _values, result) - result = SplatNode.new(val[0]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 226) - def _reduce_103(val, _values, result) - result = SplatNode.new(val[0]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 231) - def _reduce_104(val, _values, result) - result = ValueNode.new(val[0]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 232) - def _reduce_105(val, _values, result) - result = ValueNode.new(val[0]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 233) - def _reduce_106(val, _values, result) - result = ValueNode.new(val[0]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 234) - def _reduce_107(val, _values, result) - result = ValueNode.new(val[0]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 235) - def _reduce_108(val, _values, result) - result = ValueNode.new(val[0]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 236) - def _reduce_109(val, _values, result) - result = ValueNode.new(val[0]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 237) - def _reduce_110(val, _values, result) - result = ValueNode.new(val[0]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 238) - def _reduce_111(val, _values, result) - result = val[0] << val[1] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 239) - def _reduce_112(val, _values, result) - result = ValueNode.new(val[0], [val[1]]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 244) - def _reduce_113(val, _values, result) - result = AccessorNode.new(val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 245) - def _reduce_114(val, _values, result) - result = AccessorNode.new(val[1], :prototype) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 246) - def _reduce_115(val, _values, result) - result = AccessorNode.new(val[1], :soak) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 247) - def _reduce_116(val, _values, result) - result = val[0] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 248) - def _reduce_117(val, _values, result) - result = SliceNode.new(val[0]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 253) - def _reduce_118(val, _values, result) - result = IndexNode.new(val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 258) - def _reduce_119(val, _values, result) - result = ObjectNode.new(val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 263) - def _reduce_120(val, _values, result) - result = [] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 264) - def _reduce_121(val, _values, result) - result = val - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 265) - def _reduce_122(val, _values, result) - result = val[0] << val[2] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 266) - def _reduce_123(val, _values, result) - result = val[0] << val[2] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 268) - def _reduce_124(val, _values, result) - result = val[0] << val[3] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 269) - def _reduce_125(val, _values, result) - result = val[1] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 274) - def _reduce_126(val, _values, result) - result = val[0] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 275) - def _reduce_127(val, _values, result) - result = val[1].new_instance - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 276) - def _reduce_128(val, _values, result) - result = val[0] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 281) - def _reduce_129(val, _values, result) - result = ExtendsNode.new(val[0], val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 286) - def _reduce_130(val, _values, result) - result = CallNode.new(val[0], val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 287) - def _reduce_131(val, _values, result) - result = CallNode.new(val[0], val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 292) - def _reduce_132(val, _values, result) - result = val[1] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 297) - def _reduce_133(val, _values, result) - result = CallNode.new(Value.new('super'), val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 302) - def _reduce_134(val, _values, result) - result = ThisNode.new - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 303) - def _reduce_135(val, _values, result) - result = ThisNode.new(val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 309) - def _reduce_136(val, _values, result) - result = RangeNode.new(val[1], val[4]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 311) - def _reduce_137(val, _values, result) - result = RangeNode.new(val[1], val[5], true) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 317) - def _reduce_138(val, _values, result) - result = RangeNode.new(val[1], val[4]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 319) - def _reduce_139(val, _values, result) - result = RangeNode.new(val[1], val[5], true) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 324) - def _reduce_140(val, _values, result) - result = ArrayNode.new(val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 329) - def _reduce_141(val, _values, result) - result = [] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 330) - def _reduce_142(val, _values, result) - result = val - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 331) - def _reduce_143(val, _values, result) - result = [val[1]] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 332) - def _reduce_144(val, _values, result) - result = val[0] << val[2] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 333) - def _reduce_145(val, _values, result) - result = val[0] << val[2] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 334) - def _reduce_146(val, _values, result) - result = val[0] << val[3] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 335) - def _reduce_147(val, _values, result) - result = val[0] << val[3] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 336) - def _reduce_148(val, _values, result) - result = val[0] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 341) - def _reduce_149(val, _values, result) - result = val[0] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 342) - def _reduce_150(val, _values, result) - result = ([val[0]] << val[2]).flatten - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 347) - def _reduce_151(val, _values, result) - result = TryNode.new(val[1], val[2][0], val[2][1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 348) - def _reduce_152(val, _values, result) - result = TryNode.new(val[1], nil, nil, val[3]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 350) - def _reduce_153(val, _values, result) - result = TryNode.new(val[1], val[2][0], val[2][1], val[4]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 355) - def _reduce_154(val, _values, result) - result = [val[1], val[2]] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 360) - def _reduce_155(val, _values, result) - result = ThrowNode.new(val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 365) - def _reduce_156(val, _values, result) - result = ParentheticalNode.new(val[1], val[0].line) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 370) - def _reduce_157(val, _values, result) - result = WhileNode.new(val[1], val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 371) - def _reduce_158(val, _values, result) - result = WhileNode.new(val[1], nil) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 372) - def _reduce_159(val, _values, result) - result = WhileNode.new(val[2], Expressions.wrap(val[0])) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 379) - def _reduce_160(val, _values, result) - result = ForNode.new(val[0], val[3], val[2][0], val[2][1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 380) - def _reduce_161(val, _values, result) - result = ForNode.new(val[3], val[2], val[1][0], val[1][1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 385) - def _reduce_162(val, _values, result) - result = val - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 386) - def _reduce_163(val, _values, result) - result = [val[0], val[2]] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 391) - def _reduce_164(val, _values, result) - result = {:source => val[1]} - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 392) - def _reduce_165(val, _values, result) - result = {:source => val[1], :object => true} - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 394) - def _reduce_166(val, _values, result) - result = val[0].merge(:filter => val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 396) - def _reduce_167(val, _values, result) - result = val[0].merge(:step => val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 402) - def _reduce_168(val, _values, result) - result = val[3].rewrite_condition(val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 404) - def _reduce_169(val, _values, result) - result = val[3].rewrite_condition(val[1]).add_else(val[5]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 409) - def _reduce_170(val, _values, result) - result = val[0] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 410) - def _reduce_171(val, _values, result) - result = val[0] << val[1] - result - end -.,., - -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', 417) - def _reduce_173(val, _values, result) - result = IfNode.new(val[1], val[2], nil, {:statement => true}) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 418) - def _reduce_174(val, _values, result) - result = val[2].add_comment(val[0]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 423) - def _reduce_175(val, _values, result) - result = IfNode.new(val[1], val[2]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 428) - def _reduce_176(val, _values, result) - result = val[1].force_statement - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 433) - def _reduce_177(val, _values, result) - result = val[0] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 434) - def _reduce_178(val, _values, result) - result = val[0].add_else(val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 439) - def _reduce_179(val, _values, result) - result = nil - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 440) - def _reduce_180(val, _values, result) - result = val[1] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 445) - def _reduce_181(val, _values, result) - result = val[0] - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 446) - def _reduce_182(val, _values, result) - result = val[0].add_else(val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 451) - def _reduce_183(val, _values, result) - result = val[0].add_else(val[1]) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 452) - def _reduce_184(val, _values, result) - result = IfNode.new(val[2], Expressions.wrap(val[0]), nil, {:statement => true}) - result - end -.,., - -module_eval(<<'.,.,', 'grammar.y', 453) - def _reduce_185(val, _values, result) - result = IfNode.new(val[2], Expressions.wrap(val[0]), nil, {:statement => true, :invert => true}) - result - end -.,., - -def _reduce_none(val, _values, result) - val[0] -end - -end # class Parser - -end diff --git a/lib/coffee_script/rewriter.rb b/lib/coffee_script/rewriter.rb deleted file mode 100644 index 6d70327c..00000000 --- a/lib/coffee_script/rewriter.rb +++ /dev/null @@ -1,289 +0,0 @@ -module CoffeeScript - - # 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. - class Rewriter - - # 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 = BALANCED_PAIRS.map {|pair| pair.first } - - # Tokens that signal the end of a balanced pair. - EXPRESSION_TAIL = BALANCED_PAIRS.map {|pair| pair.last } - - # Tokens that indicate the close of a clause of an expression. - EXPRESSION_CLOSE = [:CATCH, :WHEN, :ELSE, :FINALLY] + 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, - :TRUE, :FALSE, :YES, :NO, :ON, :OFF, '!', '!!', :NOT, - '@', '->', '=>', '[', '(', '{'] - - # The inverse mappings of token pairs we're trying to fix up. - INVERSES = BALANCED_PAIRS.inject({}) do |memo, pair| - memo[pair.first] = pair.last - memo[pair.last] = pair.first - memo - end - - # 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. - def rewrite(tokens) - @tokens = tokens - adjust_comments - remove_leading_newlines - remove_mid_expression_newlines - move_commas_outside_outdents - close_open_calls_and_indexes - add_implicit_parentheses - add_implicit_indentation - ensure_balance(*BALANCED_PAIRS) - rewrite_closing_parens - @tokens - end - - # 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. - def scan_tokens - i = 0 - loop do - break unless @tokens[i] - move = yield(@tokens[i - 1], @tokens[i], @tokens[i + 1], i) - i += move - end - end - - # Massage newlines and indentations so that comments don't have to be - # correctly indented, or appear on their own line. - def adjust_comments - scan_tokens do |prev, token, post, i| - next 1 unless token[0] == :COMMENT - before, after = @tokens[i - 2], @tokens[i + 2] - if before && after && - ((before[0] == :INDENT && after[0] == :OUTDENT) || - (before[0] == :OUTDENT && after[0] == :INDENT)) && - before[1] == after[1] - @tokens.delete_at(i + 2) - @tokens.delete_at(i - 2) - next 0 - elsif prev[0] == "\n" && [:INDENT].include?(after[0]) - @tokens.delete_at(i + 2) - @tokens[i - 1] = after - next 1 - elsif !["\n", :INDENT, :OUTDENT].include?(prev[0]) - @tokens.insert(i, ["\n", Value.new("\n", token[1].line)]) - next 2 - else - next 1 - end - end - end - - # Leading newlines would introduce an ambiguity in the grammar, so we - # dispatch them here. - def remove_leading_newlines - @tokens.shift if @tokens[0][0] == "\n" - end - - # Some blocks occur in the middle of expressions -- when we're expecting - # this, remove their trailing newlines. - def remove_mid_expression_newlines - scan_tokens do |prev, token, post, i| - next 1 unless post && EXPRESSION_CLOSE.include?(post[0]) && token[0] == "\n" - @tokens.delete_at(i) - next 0 - end - end - - # Make sure that we don't accidentally break trailing commas, which need - # to go on the outside of expression closers. - def move_commas_outside_outdents - scan_tokens do |prev, token, post, i| - if token[0] == :OUTDENT && prev[0] == ',' - @tokens.delete_at(i) - @tokens.insert(i - 1, token) - end - next 1 - end - end - - # We've tagged the opening parenthesis of a method call, and the opening - # bracket of an indexing operation. Match them with their close. - def close_open_calls_and_indexes - parens, brackets = [0], [0] - scan_tokens do |prev, token, post, i| - case token[0] - when :CALL_START then parens.push(0) - when :INDEX_START then brackets.push(0) - when '(' then parens[-1] += 1 - when '[' then brackets[-1] += 1 - when ')' - if parens.last == 0 - parens.pop - token[0] = :CALL_END - else - parens[-1] -= 1 - end - when ']' - if brackets.last == 0 - brackets.pop - token[0] = :INDEX_END - else - brackets[-1] -= 1 - end - end - next 1 - 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. - # ')' can close a single-line block, but we need to make sure it's balanced. - def add_implicit_indentation - scan_tokens do |prev, token, post, i| - next 1 unless SINGLE_LINERS.include?(token[0]) && post[0] != :INDENT && - !(token[0] == :ELSE && post[0] == :IF) # Elsifs shouldn't get blocks. - starter = token[0] - line = token[1].line - @tokens.insert(i + 1, [:INDENT, Value.new(2, line)]) - idx = i + 1 - parens = 0 - loop do - idx += 1 - tok = @tokens[idx] - if (!tok || SINGLE_CLOSERS.include?(tok[0]) || - (tok[0] == ')' && parens == 0)) && - !(starter == :ELSE && tok[0] == :ELSE) - insertion = @tokens[idx - 1][0] == "," ? idx - 1 : idx - @tokens.insert(insertion, [:OUTDENT, Value.new(2, line)]) - break - end - parens += 1 if tok[0] == '(' - parens -= 1 if tok[0] == ')' - end - next 1 unless token[0] == :THEN - @tokens.delete_at(i) - next 0 - end - end - - # Ensure that all listed pairs of tokens are correctly balanced throughout - # the course of the token stream. - def ensure_balance(*pairs) - puts "\nbefore ensure_balance: #{@tokens.inspect}" if ENV['VERBOSE'] - levels, lines = Hash.new(0), Hash.new - scan_tokens do |prev, token, post, i| - pairs.each do |pair| - open, close = *pair - levels[open] += 1 if token[0] == open - levels[open] -= 1 if token[0] == close - lines[token[0]] = token[1].line - raise ParseError.new(token[0], token[1], nil) if levels[open] < 0 - end - next 1 - end - unclosed = levels.detect {|k, v| v > 0 } - sym = unclosed && unclosed[0] - raise ParseError.new(sym, Value.new(sym, lines[sym]), nil, "unclosed '#{sym}'") if unclosed - end - - # 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. - # - def rewrite_closing_parens - verbose = ENV['VERBOSE'] - stack, debt = [], Hash.new(0) - stack_stats = lambda { "stack: #{stack.inspect} debt: #{debt.inspect}\n\n" } - puts "rewrite_closing_original: #{@tokens.inspect}" if verbose - scan_tokens do |prev, token, post, i| - tag, inv = token[0], INVERSES[token[0]] - # Push openers onto the stack. - if EXPRESSION_START.include?(tag) - stack.push(token) - puts "pushing #{tag} #{stack_stats[]}" if verbose - next 1 - # The end of an expression, check stack and debt for a pair. - elsif EXPRESSION_TAIL.include?(tag) - puts @tokens[i..-1].inspect if verbose - # If the tag is already in our debt, swallow it. - if debt[inv] > 0 - debt[inv] -= 1 - @tokens.delete_at(i) - puts "tag in debt #{tag} #{stack_stats[]}" if verbose - next 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] - puts "expected tag #{tag} #{stack_stats[]}" if verbose - next 1 - else - # Unexpected close, insert correct close, adding to the debt. - debt[mtag] += 1 - puts "unexpected #{tag}, replacing with #{INVERSES[mtag]} #{stack_stats[]}" if verbose - val = mtag == :INDENT ? match[1] : INVERSES[mtag] - @tokens.insert(i, [INVERSES[mtag], Value.new(val, token[1].line)]) - next 1 - end - end - else - # Uninteresting token: - next 1 - end - end - end - - end -end \ No newline at end of file diff --git a/lib/coffee_script/scope.rb b/lib/coffee_script/scope.rb deleted file mode 100644 index fe4385bc..00000000 --- a/lib/coffee_script/scope.rb +++ /dev/null @@ -1,95 +0,0 @@ -module CoffeeScript - - # Scope objects form a tree corresponding to the shape of the function - # definitions present in the script. They provide lexical scope, to determine - # whether a variable has been seen before or if it needs to be declared. - class Scope - - attr_reader :parent, :expressions, :function, :variables, :temp_variable - - # Initialize a scope with its parent, for lookups up the chain, - # as well as the Expressions body where it should declare its variables, - # and the function that it wraps. - def initialize(parent, expressions, function) - @parent, @expressions, @function = parent, expressions, function - @variables = {} - @temp_variable = @parent ? @parent.temp_variable.dup : '__a' - end - - # Look up a variable in lexical scope, or declare it if not found. - def find(name, remote=false) - found = check(name) - return found if found || remote - @variables[name.to_sym] = :var - found - end - - # Define a local variable as originating from a parameter in current scope - # -- no var required. - def parameter(name) - @variables[name.to_sym] = :param - end - - # Just check to see if a variable has already been declared. - def check(name) - return true if @variables[name.to_sym] - !!(@parent && @parent.check(name)) - end - - # You can reset a found variable on the immediate scope. - def reset(name) - @variables[name.to_sym] = false - end - - # Find an available, short, name for a compiler-generated variable. - def free_variable - @temp_variable.succ! while check(@temp_variable) - @variables[@temp_variable.to_sym] = :var - Value.new(@temp_variable.dup) - end - - # Ensure that an assignment is made at the top of scope (or top-level - # scope, if requested). - def assign(name, value, top=false) - return @parent.assign(name, value, top) if top && @parent - @variables[name.to_sym] = Value.new(value) - end - - # Does this scope reference any variables that need to be declared in the - # given function body? - def declarations?(body) - !declared_variables.empty? && body == @expressions - end - - # Does this scope reference any assignments that need to be declared at the - # top of the given function body? - def assignments?(body) - !assigned_variables.empty? && body == @expressions - end - - # Return the list of variables first declared in current scope. - def declared_variables - @variables.select {|k, v| v == :var }.map {|pair| pair[0].to_s }.sort - end - - # Return the list of variables that are supposed to be assigned at the top - # of scope. - def assigned_variables - @variables.select {|k, v| v.is_a?(Value) }.sort_by {|pair| pair[0].to_s } - end - - def compiled_declarations - declared_variables.join(', ') - end - - def compiled_assignments - assigned_variables.map {|name, val| "#{name} = #{val}"}.join(', ') - end - - def inspect - "" - end - - end - -end \ No newline at end of file diff --git a/lib/coffee_script/value.rb b/lib/coffee_script/value.rb deleted file mode 100644 index 8cb2207d..00000000 --- a/lib/coffee_script/value.rb +++ /dev/null @@ -1,64 +0,0 @@ -module CoffeeScript - - # Instead of producing raw Ruby objects, the Lexer produces values of this - # class, wrapping native objects tagged with line number information. - # Values masquerade as both strings and nodes -- being used both as nodes in - # the AST, and as literally-interpolated values in the generated code. - class Value - attr_reader :value, :line - - def initialize(value, line=nil) - @value, @line = value, line - end - - def to_str - @value.to_s - end - alias_method :to_s, :to_str - - def to_sym - to_str.to_sym - end - - def compile(o={}) - to_s - end - - def inspect - @value.inspect - end - - def ==(other) - @value == other - end - - def [](index) - @value[index] - end - - def eql?(other) - @value.eql?(other) - end - - def hash - @value.hash - end - - def match(regex) - @value.match(regex) - end - - def children - [] - end - - def statement_only? - false - end - - def contains? - false - end - end - -end \ No newline at end of file