X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/55fc1817b91ea69a393f7d149ea6848be5abbfed..79492f212da2fcaa4ce44d00fc08530e1630d05b:/Cycript.yy.in
diff --git a/Cycript.yy.in b/Cycript.yy.in
index d8ec64a..b2f5629 100644
--- a/Cycript.yy.in
+++ b/Cycript.yy.in
@@ -1,21 +1,21 @@
/* Cycript - Optimizing JavaScript Compiler/Runtime
- * Copyright (C) 2009-2010 Jay Freeman (saurik)
+ * Copyright (C) 2009-2014 Jay Freeman (saurik)
*/
-/* GNU Lesser General Public License, Version 3 {{{ */
+/* GNU Affero General Public License, Version 3 {{{ */
/*
- * 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.
- *
- * 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.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Cycript. If not, see .
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * This program 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 Affero General Public License for more details.
+
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
**/
/* }}} */
@@ -28,6 +28,7 @@
@if Bison24 }
@if Bison24 %code requires {
+#include "Driver.hpp"
#include "Parser.hpp"
#define CYNew new($pool)
@@ -39,8 +40,11 @@
#include "E4X/Syntax.hpp"
@end
+#include "Highlight.hpp"
+
typedef struct {
bool newline_;
+ hi::Value highlight_;
union {
bool bool_;
@@ -68,6 +72,7 @@ typedef struct {
CYInfix *infix_;
CYLiteral *literal_;
CYMember *member_;
+ CYModule *module_;
CYNull *null_;
CYNumber *number_;
CYProgram *program_;
@@ -80,6 +85,13 @@ typedef struct {
CYTrue *true_;
CYWord *word_;
+@begin C
+ CYTypeModifier *modifier_;
+ CYTypeSpecifier *specifier_;
+ CYTypedIdentifier *typedIdentifier_;
+ CYTypedParameter *typedParameter_;
+@end
+
@begin ObjectiveC
CYClassName *className_;
CYField *field_;
@@ -98,12 +110,17 @@ typedef struct {
} YYSTYPE;
#define YYSTYPE YYSTYPE
-@if Bison24 }
@if Bison24 %code provides {
int cylex(YYSTYPE *, cy::location *, void *);
@if Bison24 }
+@if Bison23 %}
+@if Bison23 %union {
+@if Bison23 }
+@if Bison23 %{
+
+@if Bison24 }
@if Bison23 %}
%name-prefix="cy"
@@ -126,6 +143,7 @@ int cylex(YYSTYPE *, cy::location *, void *);
%parse-param { CYDriver &driver }
%lex-param { void *cyscanner }
+/* Token Declarations {{{ */
@begin E4X
%token XMLCDATA
%token XMLComment
@@ -151,6 +169,7 @@ int cylex(YYSTYPE *, cy::location *, void *);
@begin E4X ObjectiveC
%token At "@"
+%token Pound "#"
@end
%token Ampersand "&"
@@ -161,6 +180,7 @@ int cylex(YYSTYPE *, cy::location *, void *);
%token Equal "="
%token EqualEqual "=="
%token EqualEqualEqual "==="
+%token EqualRight "=>"
%token Exclamation "!"
%token ExclamationEqual "!="
%token ExclamationEqualEqual "!=="
@@ -209,20 +229,37 @@ int cylex(YYSTYPE *, cy::location *, void *);
%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"
+%token Unsigned "unsigned"
+%token Signed "signed"
+%token Extern "extern"
+@end
+
+@begin C
+%token AtEncode "@encode"
+@end
+
@begin ObjectiveC
%token AtImplementation "@implementation"
+%token AtImplementation_ ";@implementation"
%token AtImport "@import"
%token AtEnd "@end"
%token AtSelector "@selector"
+%token Yes "YES"
+%token No "NO"
@end
%token False "false"
@@ -230,6 +267,7 @@ int cylex(YYSTYPE *, cy::location *, void *);
%token True "true"
// ES3/ES5/WIE/JSC Reserved
+%token Auto "auto"
%token Break "break"
%token Case "case"
%token Catch "catch"
@@ -241,8 +279,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"
@@ -303,6 +343,7 @@ int cylex(YYSTYPE *, cy::location *, void *);
// Woah?!
%token Each "each"
+%token Of "of"
@begin E4X
// E4X Conditional
@@ -318,50 +359,45 @@ int cylex(YYSTYPE *, cy::location *, void *);
%token RegularExpressionLiteral
%type AdditiveExpression
-%type AdditiveExpressionNoBF
%type ArgumentList_
%type ArgumentList
%type ArgumentListOpt
%type Arguments
+%type ArrayComprehension
+%type ArrayInitialiser
%type ArrayLiteral
-%type AssigneeExpression
-%type AssigneeExpressionNoBF
-%type AssignmentExpression_
+%type ArrowFunction
+%type ArrowParameters
%type AssignmentExpression
-%type AssignmentExpressionNoBF
-%type AssignmentExpressionNoIn
+%type Binding
%type BindingIdentifier
%type BitwiseANDExpression
-%type BitwiseANDExpressionNoBF
-%type BitwiseANDExpressionNoIn
%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 ComprehensionList
-%type ComprehensionListOpt
+%type Comprehension
+%type ComprehensionFor
+%type ComprehensionIf
+%type ComprehensionTail
%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,21 +405,12 @@ int cylex(YYSTYPE *, cy::location *, void *);
%type ElseStatementOpt
%type EmptyStatement
%type EqualityExpression
-%type EqualityExpressionNoBF
-%type EqualityExpressionNoIn
%type Expression_
-%type Expression
+%type Expression
%type ExpressionOpt
-%type ExpressionNoBF
-%type ExpressionNoIn_
-%type ExpressionNoIn
-%type ExpressionNoInOpt
%type ExpressionStatement
%type FinallyOpt
-%type ForComprehension
-%type ForStatement
%type ForStatementInitialiser
-%type ForInStatement
%type ForInStatementInitialiser
%type FormalParameter
%type FormalParameterList_
@@ -394,69 +421,51 @@ int cylex(YYSTYPE *, cy::location *, void *);
%type FunctionExpression
%type Identifier
%type IdentifierOpt
-%type IfComprehension
+%type IdentifierType
+%type IdentifierName
%type IfStatement
%type Initialiser
%type InitialiserOpt
-%type InitialiserNoIn
-%type InitialiserNoInOpt
%type IterationStatement
%type LabelledStatement
%type LeftHandSideExpression
-%type LeftHandSideExpressionNoBF
-//%type LetExpression
%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 Module
%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 ProgramBody
%type ProgramBodyOpt
%type PropertyName_
%type PropertyName
-%type PropertyNameAndValueList_
-%type PropertyNameAndValueList
-%type PropertyNameAndValueListOpt
-%type RelationalExpression_
+%type PropertyDefinition
+%type PropertyDefinitionList_
+%type PropertyDefinitionList
+%type PropertyDefinitionListOpt
%type RelationalExpression
-%type RelationalExpressionNoBF
-%type RelationalExpressionNoIn_
-%type RelationalExpressionNoIn
%type ReturnStatement
%type RubyProcExpression
-%type RubyProcExpressionNoOA
%type RubyProcParameterList_
%type RubyProcParameterList
%type RubyProcParameters
%type RubyProcParametersOpt
%type ShiftExpression
-%type ShiftExpressionNoBF
%type SingleNameBinding
+%type Statement__
%type Statement_
%type Statement
%type StatementList
@@ -467,34 +476,41 @@ int cylex(YYSTYPE *, cy::location *, void *);
%type TryStatement
%type UnaryExpression_
%type UnaryExpression
-%type UnaryExpressionNoBF
%type VariableDeclaration
-%type VariableDeclarationNoIn
%type VariableDeclarationList_
%type VariableDeclarationList
-%type VariableDeclarationListNoIn_
-%type VariableDeclarationListNoIn
%type VariableStatement
-%type WhileStatement
%type WithStatement
+%type Word
+%type WordOpt
+%type Variable
@begin C
-%type AssigneeExpressionNoRE
-%type CallExpressionNoRE
-%type LeftHandSideExpressionNoRE
-%type MemberExpressionNoRE
-%type NewExpressionNoRE
-%type PostfixExpressionNoRE
-%type UnaryAssigneeExpression
-%type UnaryExpressionNoRE
+%type ArrayedType
+%type FunctionedType
+%type IntegerType
+%type IntegerTypeOpt
+%type PrefixedType
+%type PrimitiveType
+%type TypeParenthetical
+%type TypeSignifier
+%type SuffixedType
+%type TypeQualifierLeft
+%type TypeQualifierRight
+%type TypedIdentifier
+%type TypedParameterList_
+%type TypedParameterList
+%type TypedParameterListOpt
@end
@begin ObjectiveC
+%type BoxableExpression
%type CategoryStatement
%type ClassExpression
+%type ClassFieldListOpt
+%type ClassFields
%type ClassStatement
%type ClassSuperOpt
-%type ClassFieldList
%type ClassMessageDeclaration
%type ClassMessageDeclarationListOpt
%type ClassName
@@ -508,6 +524,7 @@ int cylex(YYSTYPE *, cy::location *, void *);
%type MessageParameterList
%type MessageParameterListOpt
%type MessageScope
+%type ModifiedType
%type SelectorCall_
%type SelectorCall
%type SelectorExpression_
@@ -515,10 +532,8 @@ int cylex(YYSTYPE *, cy::location *, void *);
%type SelectorExpressionOpt
%type SelectorList
%type SelectorWordOpt
-%type TypeOpt
+%type TypeOpt
%type VariadicCall
-%type Word
-%type WordOpt
@end
@begin E4X
@@ -541,68 +556,70 @@ int cylex(YYSTYPE *, cy::location *, void *);
%type XMLListInitialiser
%type