X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/7198f00397564ab468b47bdc23b378e2996e6e61..b5af12b8bc9c3fda53ebce1ba823734a279610c9:/Cycript.yy.in
diff --git a/Cycript.yy.in b/Cycript.yy.in
index 0181676..62cdca2 100644
--- a/Cycript.yy.in
+++ b/Cycript.yy.in
@@ -1,40 +1,22 @@
-/* Cycript - Inlining/Optimizing JavaScript Compiler
- * Copyright (C) 2009 Jay Freeman (saurik)
+/* Cycript - Optimizing JavaScript Compiler/Runtime
+ * Copyright (C) 2009-2012 Jay Freeman (saurik)
*/
-/* Modified BSD License {{{ */
+/* GNU Lesser General Public License, Version 3 {{{ */
/*
- * Redistribution and use in source and binary
- * forms, with or without modification, are permitted
- * provided that the following conditions are met:
+ * Cycript is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version.
*
- * 1. Redistributions of source code must retain the
- * above copyright notice, this list of conditions
- * and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions
- * and the following disclaimer in the documentation
- * and/or other materials provided with the
- * distribution.
- * 3. The name of the author may not be used to endorse
- * or promote products derived from this software
- * without specific prior written permission.
+ * 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 Lesser General Public
+ * License for more details.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
- * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Cycript. If not, see .
+**/
/* }}} */
@if Bison23 %{
@@ -47,6 +29,7 @@
@if Bison24 %code requires {
#include "Parser.hpp"
+#define CYNew new($pool)
@begin ObjectiveC
#include "ObjectiveC/Syntax.hpp"
@@ -56,8 +39,11 @@
#include "E4X/Syntax.hpp"
@end
+#include "Highlight.hpp"
+
typedef struct {
bool newline_;
+ hi::Value highlight_;
union {
bool bool_;
@@ -90,6 +76,7 @@ typedef struct {
CYProgram *program_;
CYProperty *property_;
CYPropertyName *propertyName_;
+ CYRubyProc *rubyProc_;
CYStatement *statement_;
CYString *string_;
CYThis *this_;
@@ -103,6 +90,9 @@ typedef struct {
CYMessageParameter *messageParameter_;
CYProtocol *protocol_;
CYSelectorPart *selector_;
+ CYTypeModifier *type_;
+ CYTypedIdentifier *typedIdentifier_;
+ CYTypedParameter *typedParameter_;
@end
@begin E4X
@@ -142,6 +132,7 @@ int cylex(YYSTYPE *, cy::location *, void *);
%parse-param { CYDriver &driver }
%lex-param { void *cyscanner }
+/* Token Declarations {{{ */
@begin E4X
%token XMLCDATA
%token XMLComment
@@ -177,6 +168,7 @@ int cylex(YYSTYPE *, cy::location *, void *);
%token Equal "="
%token EqualEqual "=="
%token EqualEqualEqual "==="
+%token EqualRight "=>"
%token Exclamation "!"
%token ExclamationEqual "!="
%token ExclamationEqualEqual "!=="
@@ -192,6 +184,7 @@ int cylex(YYSTYPE *, cy::location *, void *);
%token Percent "%"
%token PercentEqual "%="
%token Period "."
+%token PeriodPeriodPeriod "..."
%token Pipe "|"
%token PipeEqual "|="
%token PipePipe "||"
@@ -223,20 +216,32 @@ int cylex(YYSTYPE *, cy::location *, void *);
%token CloseParen ")"
%token OpenBrace "{"
+%token OpenBrace_ "\n{"
+%token OpenBrace__ ";{"
%token CloseBrace "}"
%token OpenBracket "["
%token CloseBracket "]"
+@begin Java
%token AtClass "@class"
-%token AtSelector "@selector"
+@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"
@@ -248,8 +253,10 @@ int cylex(YYSTYPE *, cy::location *, void *);
%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"
@@ -310,6 +317,7 @@ int cylex(YYSTYPE *, cy::location *, void *);
// Woah?!
%token Each "each"
+%token Of "of"
@begin E4X
// E4X Conditional
@@ -317,51 +325,51 @@ int cylex(YYSTYPE *, cy::location *, void *);
%token XML "xml"
@end
+%token AutoComplete
+
%token Identifier_
%token NumericLiteral
%token StringLiteral
%token RegularExpressionLiteral
%type AdditiveExpression
-%type AdditiveExpressionNoBF
-%type ArgumentList
%type ArgumentList_
+%type ArgumentList
%type ArgumentListOpt
%type Arguments
%type ArrayLiteral
-%type AssigneeExpression
-%type AssigneeExpressionNoBF
+%type ArrowFunction
+%type ArrowParameters
%type AssignmentExpression
-%type AssignmentExpression_
-%type AssignmentExpressionNoBF
-%type AssignmentExpressionNoIn
+%type Binding
+%type BindingIdentifier
%type BitwiseANDExpression
-%type BitwiseANDExpressionNoBF
-%type BitwiseANDExpressionNoIn
-%type Block
%type Block_
+%type Block
%type BooleanLiteral
+%type BindingElement
%type BitwiseORExpression
-%type BitwiseORExpressionNoBF
-%type BitwiseORExpressionNoIn
%type BitwiseXORExpression
-%type BitwiseXORExpressionNoBF
-%type BitwiseXORExpressionNoIn
%type BreakStatement
+%type BreakableStatement
+%type CallExpression_
%type CallExpression
-%type CallExpressionNoBF
%type CaseBlock
%type CaseClause
%type CaseClausesOpt
%type CatchOpt
+%type ComprehensionForList
+%type ComprehensionForListOpt
%type ComprehensionList
%type ComprehensionListOpt
%type ConditionalExpression
-%type ConditionalExpressionNoBF
-%type ConditionalExpressionNoIn
%type ContinueStatement
+%type ConciseBody
+%type DebuggerStatement
+%type Declaration__
+%type Declaration_
+%type Declaration
%type DefaultClause
-%type DoWhileStatement
%type Element
%type ElementOpt
%type ElementList
@@ -369,121 +377,94 @@ int cylex(YYSTYPE *, cy::location *, void *);
%type ElseStatementOpt
%type EmptyStatement
%type EqualityExpression
-%type EqualityExpressionNoBF
-%type EqualityExpressionNoIn
-%type Expression
-%type ExpressionOpt
%type Expression_
-%type ExpressionNoBF
-%type ExpressionNoIn
-%type ExpressionNoIn_
-%type ExpressionNoInOpt
+%type Expression
+%type ExpressionOpt
%type ExpressionStatement
%type FinallyOpt
%type ForComprehension
-%type ForStatement
%type ForStatementInitialiser
-%type ForInStatement
%type ForInStatementInitialiser
-%type FormalParameterList
+%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 InitialiserNoIn
-%type InitialiserNoInOpt
%type IterationStatement
%type LabelledStatement
%type LeftHandSideExpression
-%type LeftHandSideExpressionNoBF
-//%type LetStatement
+%type LetStatement
+%type LexicalDeclaration
%type Literal
-%type LiteralNoRE
-%type LiteralRE
+%type ValueLiteral
%type LogicalANDExpression
-%type LogicalANDExpressionNoBF
-%type LogicalANDExpressionNoIn
%type LogicalORExpression
-%type LogicalORExpressionNoBF
-%type LogicalORExpressionNoIn
%type MemberAccess
-%type MemberExpression
%type MemberExpression_
-%type MemberExpressionNoBF
+%type MemberExpression
%type MultiplicativeExpression
-%type MultiplicativeExpressionNoBF
%type NewExpression
-%type NewExpression_
-%type NewExpressionNoBF
%type NullLiteral
%type ObjectLiteral
+%type Parenthetical
+%type ParentheticalOpt
%type PostfixExpression
-%type PostfixExpressionNoBF
%type PrimaryExpression
-%type PrimaryExpressionNo
-%type PrimaryExpressionNoBF
-%type PrimaryExpressionNoRE
-%type PrimaryExpressionBF
%type Program
-%type PropertyName
+%type ProgramBody
+%type ProgramBodyOpt
%type PropertyName_
-%type PropertyNameAndValueList
-%type PropertyNameAndValueList_
-%type PropertyNameAndValueListOpt
+%type PropertyName
+%type PropertyDefinition
+%type PropertyDefinitionList_
+%type PropertyDefinitionList
+%type PropertyDefinitionListOpt
%type RelationalExpression
-%type RelationalExpression_
-%type RelationalExpressionNoBF
-%type RelationalExpressionNoIn
-%type RelationalExpressionNoIn_
%type ReturnStatement
+%type RubyProcExpression
+%type RubyProcParameterList_
+%type RubyProcParameterList
+%type RubyProcParameters
+%type RubyProcParametersOpt
%type ShiftExpression
-%type ShiftExpressionNoBF
-%type SourceElement
-%type SourceElement_
-%type SourceElements
-%type Statement
+%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 UnaryExpressionNoBF
+%type UnaryExpression
%type VariableDeclaration
-%type VariableDeclarationNoIn
-%type VariableDeclarationList
%type VariableDeclarationList_
-%type VariableDeclarationListNoIn
-%type VariableDeclarationListNoIn_
+%type VariableDeclarationList
%type VariableStatement
-%type WhileStatement
%type WithStatement
-
-@begin C
-%type AssigneeExpressionNoRE
-%type CallExpressionNoRE
-%type LeftHandSideExpressionNoRE
-%type MemberExpressionNoRE
-%type NewExpressionNoRE
-%type PostfixExpressionNoRE
-%type UnaryAssigneeExpression
-%type UnaryExpressionNoRE
-@end
+%type Word
+%type WordOpt
+%type Variable
@begin ObjectiveC
+%type BoxableExpression
%type CategoryStatement
%type ClassExpression
+%type ClassFieldListOpt
+%type ClassFields
%type ClassStatement
%type ClassSuperOpt
-%type ClassFieldList
%type ClassMessageDeclaration
%type ClassMessageDeclarationListOpt
%type ClassName
@@ -491,30 +472,39 @@ int cylex(YYSTYPE *, cy::location *, void *);
%type ClassProtocolListOpt
%type ClassProtocols
%type ClassProtocolsOpt
+%type EncodedType
%type MessageExpression
%type MessageParameter
%type MessageParameters
%type MessageParameterList
%type MessageParameterListOpt
%type MessageScope
-%type SelectorCall
+%type ModifiedType
+%type PrefixedType
+%type PrimitiveType
+%type QualifiedType
%type SelectorCall_
-%type SelectorExpression
+%type SelectorCall
%type SelectorExpression_
+%type