/* Cycript - Optimizing JavaScript Compiler/Runtime
 * Copyright (C) 2009-2013  Jay Freeman (saurik)
*/
/* GNU General Public License, Version 3 {{{ */
/*
 * Cycript is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published
 * by the Free Software Foundation, either version 3 of the License,
 * or (at your option) any later version.
 *
 * Cycript is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Cycript.  If not, see .
**/
/* }}} */
@if Bison23 %{
@if Bison24 %code top {
#define cyscanner driver.scanner_
#define YYSTACKEXPANDABLE 1
@if Bison23 #define yyerrok (yyerrstatus_ = 0)
@if Bison24 }
@if Bison24 %code requires {
#include "Driver.hpp"
#include "Parser.hpp"
#define CYNew new($pool)
@begin ObjectiveC
#include "ObjectiveC/Syntax.hpp"
@end
@begin E4X
#include "E4X/Syntax.hpp"
@end
#include "Highlight.hpp"
typedef struct {
    bool newline_;
    hi::Value highlight_;
    union {
        bool bool_;
        CYDriver::Condition condition_;
        CYArgument *argument_;
        CYAssignment *assignment_;
        CYBoolean *boolean_;
        CYClause *clause_;
        cy::Syntax::Catch *catch_;
        CYComment *comment_;
        CYComprehension *comprehension_;
        CYCompound *compound_;
        CYDeclaration *declaration_;
        CYDeclarations *declarations_;
        CYElement *element_;
        CYExpression *expression_;
        CYFalse *false_;
        CYFinally *finally_;
        CYForInitialiser *for_;
        CYForInInitialiser *forin_;
        CYFunctionParameter *functionParameter_;
        CYIdentifier *identifier_;
        CYInfix *infix_;
        CYLiteral *literal_;
        CYMember *member_;
        CYNull *null_;
        CYNumber *number_;
        CYProgram *program_;
        CYProperty *property_;
        CYPropertyName *propertyName_;
        CYRubyProc *rubyProc_;
        CYStatement *statement_;
        CYString *string_;
        CYThis *this_;
        CYTrue *true_;
        CYWord *word_;
@begin ObjectiveC
        CYClassName *className_;
        CYField *field_;
        CYMessage *message_;
        CYMessageParameter *messageParameter_;
        CYProtocol *protocol_;
        CYSelectorPart *selector_;
        CYTypeModifier *type_;
        CYTypedIdentifier *typedIdentifier_;
        CYTypedParameter *typedParameter_;
@end
@begin E4X
        CYAttribute *attribute_;
        CYPropertyIdentifier *propertyIdentifier_;
        CYSelector *selector_;
@end
    };
} YYSTYPE;
#define YYSTYPE YYSTYPE
@if Bison24 }
@if Bison24 %code provides {
int cylex(YYSTYPE *, cy::location *, void *);
@if Bison24 }
@if Bison23 %}
%name-prefix="cy"
@if Bison23 %skeleton "lalr1.cc"
@if Bison24 %language "C++"
%initial-action {
    @$.begin.filename = @$.end.filename = &driver.filename_;
};
%locations
%defines
//%glr-parser
//%expect 1
%error-verbose
%parse-param { CYDriver &driver }
%lex-param { void *cyscanner }
/* Token Declarations {{{ */
@begin E4X
%token XMLCDATA
%token XMLComment
%token XMLPI
%token XMLAttributeValue
%token XMLName
%token XMLTagCharacters
%token XMLText
%token XMLWhitespace
@end
@begin E4X
%token LeftRight "<>"
%token LeftSlashRight ">"
%token SlashRight "/>"
%token LeftSlash ""
%token ColonColon "::"
%token PeriodPeriod ".."
@end
@begin E4X ObjectiveC
%token At "@"
@end
%token Ampersand "&"
%token AmpersandAmpersand "&&"
%token AmpersandEqual "&="
%token Carrot "^"
%token CarrotEqual "^="
%token Equal "="
%token EqualEqual "=="
%token EqualEqualEqual "==="
%token EqualRight "=>"
%token Exclamation "!"
%token ExclamationEqual "!="
%token ExclamationEqualEqual "!=="
%token Hyphen "-"
%token HyphenEqual "-="
%token HyphenHyphen "--"
%token HyphenHyphen_ "\n--"
%token HyphenRight "->"
%token Left "<"
%token LeftEqual "<="
%token LeftLeft "<<"
%token LeftLeftEqual "<<="
%token Percent "%"
%token PercentEqual "%="
%token Period "."
%token PeriodPeriodPeriod "..."
%token Pipe "|"
%token PipeEqual "|="
%token PipePipe "||"
%token Plus "+"
%token PlusEqual "+="
%token PlusPlus "++"
%token PlusPlus_ "\n++"
%token Right ">"
%token RightEqual ">="
%token RightRight ">>"
%token RightRightEqual ">>="
%token RightRightRight ">>>"
%token RightRightRightEqual ">>>="
%token Slash "/"
%token SlashEqual "/="
%token Star "*"
%token StarEqual "*="
%token Tilde "~"
%token Colon ":"
%token Comma ","
%token Question "?"
%token SemiColon ";"
%token NewLine "\n"
%token  Comment
%token OpenParen "("
%token CloseParen ")"
%token OpenBrace "{"
%token OpenBrace_ "\n{"
%token OpenBrace__ ";{"
%token CloseBrace "}"
%token OpenBracket "["
%token CloseBracket "]"
%token AtError "@error"
@begin Java
%token AtClass "@class"
@end
@begin C
%token  Typedef "typedef"
@end
@begin ObjectiveC
%token AtImplementation "@implementation"
%token AtImplementation_ ";@implementation"
%token AtImport "@import"
%token AtEncode "@encode"
%token AtEnd "@end"
%token AtSelector "@selector"
@end
%token  False "false"
%token  Null "null"
%token  True "true"
// ES3/ES5/WIE/JSC Reserved
%token  Auto "auto"
%token  Break "break"
%token  Case "case"
%token  Catch "catch"
%token  Continue "continue"
%token  Default "default"
%token  Delete "delete"
%token  Do "do"
%token  Else "else"
%token  Finally "finally"
%token  For "for"
%token  Function "function"
%token  Function_ ";function"
%token  If "if"
%token  In "in"
%token  In_ "!in"
%token  InstanceOf "instanceof"
%token  New "new"
%token  Return "return"
%token  Switch "switch"
%token  This "this"
%token  Throw "throw"
%token  Try "try"
%token  TypeOf "typeof"
%token  Var "var"
%token  Void "void"
%token  While "while"
%token  With "with"
// ES3/IE6 Future, ES5/JSC Reserved
%token  Debugger "debugger"
// ES3/ES5/IE6 Future, JSC Reserved
%token  Const "const"
// ES3/ES5/IE6/JSC Future
%token  Class "class"
%token  Enum "enum"
%token  Export "export"
%token  Extends "extends"
%token  Import "import"
%token  Super "super"
// ES3 Future, ES5 Strict Future
%token  Implements "implements"
%token  Interface "interface"
%token  Package "package"
%token  Private "private"
%token  Protected "protected"
%token  Public "public"
%token  Static "static"
// ES3 Future
%token  Abstract "abstract"
%token  Boolean "boolean"
%token  Byte "byte"
%token  Char "char"
%token  Double "double"
%token  Final "final"
%token  Float "float"
%token  Goto "goto"
%token  Int "int"
%token  Long "long"
%token  Native "native"
%token  Short "short"
%token  Synchronized "synchronized"
%token  Throws "throws"
%token  Transient "transient"
%token  Volatile "volatile"
// ES5 Strict
%token  Let "let"
%token  Yield "yield"
// Woah?!
%token  Each "each"
%token  Of "of"
@begin E4X
// E4X Conditional
%token  Namespace "namespace"
%token  XML "xml"
@end
%token AutoComplete
%token  Identifier_
%token  NumericLiteral
%token  StringLiteral
%token  RegularExpressionLiteral
%type  AdditiveExpression
%type  ArgumentList_
%type  ArgumentList
%type  ArgumentListOpt
%type  Arguments
%type  ArrayLiteral
%type  ArrowFunction
%type  ArrowParameters
%type  AssignmentExpression
%type  Binding
%type  BindingIdentifier
%type  BitwiseANDExpression
%type  Block_
%type  Block
%type  BooleanLiteral
%type  BindingElement
%type  BitwiseORExpression
%type  BitwiseXORExpression
%type  BreakStatement
%type  BreakableStatement
%type  CallExpression_
%type  CallExpression
%type  CaseBlock
%type  CaseClause
%type  CaseClausesOpt
%type  CatchOpt
%type  ComprehensionForList
%type  ComprehensionForListOpt
%type  ComprehensionList
%type  ComprehensionListOpt
%type  ConditionalExpression
%type  ContinueStatement
%type  ConciseBody
%type  DebuggerStatement
%type  Declaration__
%type  Declaration_
%type  Declaration
%type  DefaultClause
%type  Element
%type  ElementOpt
%type  ElementList
%type  ElementListOpt
%type  ElseStatementOpt
%type  EmptyStatement
%type  EqualityExpression
%type  Expression_
%type  Expression
%type  ExpressionOpt
%type  ExpressionStatement
%type  FinallyOpt
%type  ForComprehension
%type  ForStatementInitialiser
%type  ForInStatementInitialiser
%type  FormalParameter
%type  FormalParameterList_
%type  FormalParameterList
%type  FormalParameterListOpt
%type  FunctionBody
%type  FunctionDeclaration
%type  FunctionExpression
%type  Identifier
%type  IdentifierOpt
%type  IdentifierName
%type  IfComprehension
%type  IfStatement
%type  Initialiser
%type  InitialiserOpt
%type  IterationStatement
%type  LabelledStatement
%type  LeftHandSideExpression
%type  LetStatement
%type  LexicalDeclaration
%type  Literal
%type  ValueLiteral
%type  LogicalANDExpression
%type  LogicalORExpression
%type  MemberAccess
%type  MemberExpression_
%type  MemberExpression
%type  MultiplicativeExpression
%type  NewExpression
%type  NullLiteral
%type  ObjectLiteral
%type  Parenthetical
%type  ParentheticalOpt
%type  PostfixExpression
%type  PrimaryExpression
%type  Program
%type  ProgramBody
%type  ProgramBodyOpt
%type  PropertyName_
%type  PropertyName
%type  PropertyDefinition
%type  PropertyDefinitionList_
%type  PropertyDefinitionList
%type  PropertyDefinitionListOpt
%type  RelationalExpression
%type  ReturnStatement
%type  RubyProcExpression
%type  RubyProcParameterList_
%type  RubyProcParameterList
%type  RubyProcParameters
%type  RubyProcParametersOpt
%type  ShiftExpression
%type  SingleNameBinding
%type  Statement__
%type  Statement_
%type  Statement
%type  StatementList
%type  StatementListOpt
%type  StatementListItem
%type  SwitchStatement
%type  ThrowStatement
%type  TryStatement
%type  UnaryExpression_
%type  UnaryExpression
%type  VariableDeclaration
%type  VariableDeclarationList_
%type  VariableDeclarationList
%type  VariableStatement
%type  WithStatement
%type  Word
%type  WordOpt
%type  Variable
@begin ObjectiveC
%type  ArrayedType
%type  BoxableExpression
%type  CategoryStatement
%type  ClassExpression
%type  ClassFieldListOpt
%type  ClassFields
%type  ClassStatement
%type  ClassSuperOpt
%type  ClassMessageDeclaration
%type  ClassMessageDeclarationListOpt
%type  ClassName
%type  ClassNameOpt
%type  ClassProtocolListOpt
%type  ClassProtocols
%type  ClassProtocolsOpt
%type  ConcreteType
%type  EncodedType
%type  MessageExpression
%type  MessageParameter
%type  MessageParameters
%type  MessageParameterList
%type  MessageParameterListOpt
%type  MessageScope
%type  ModifiedType_
%type  ModifiedType
%type  PrefixedType
%type  PrimitiveType
%type  SelectorCall_
%type  SelectorCall
%type  SelectorExpression_
%type  SelectorExpression
%type  SelectorExpressionOpt
%type  SelectorList
%type  SelectorWordOpt
%type  SuffixedType
%type  TypeOpt
%type  TypeParenthetical
%type  TypeQualifierLeft
%type  TypeQualifierRight
%type  TypeSignifier
%type  TypedIdentifier
%type  TypedParameterList_
%type  TypedParameterList
%type  TypedParameterListOpt
%type  VariadicCall
@end
@begin E4X
%type  PropertyIdentifier_
%type  PropertySelector_
%type  PropertySelector
%type  QualifiedIdentifier_
%type  QualifiedIdentifier
%type  WildcardIdentifier
%type  XMLComment
%type  XMLCDATA
%type  XMLElement
%type  XMLElementContent
%type  XMLMarkup
%type