Skip to content

Commit

Permalink
Merge fd955c8 into 8eb51c9
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi committed Nov 6, 2018
2 parents 8eb51c9 + fd955c8 commit fdffbd1
Show file tree
Hide file tree
Showing 73 changed files with 1,644 additions and 354 deletions.
39 changes: 20 additions & 19 deletions src/ast.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,30 @@ const Position = require("./ast/position");
* - [TraitAlias](#traitalias)
* - [TraitPrecedence](#traitprecedence)
* - [Entry](#entry)
* - [Case](#case)
* - [Label](#label)
* - [Comment](#comment)
* - [CommentLine](#commentline)
* - [CommentBlock](#commentblock)
* - [Error](#error)
* - [Expression](#expression)
* - [Silent](#silent)
* - [RetIf](#retif)
* - [New](#new)
* - [Include](#include)
* - [Call](#call)
* - [Eval](#eval)
* - [Exit](#exit)
* - [Clone](#clone)
* - [Assign](#assign)
* - [Array](#array)
* - [List](#list)
* - [Variable](#variable)
* - [Variadic](#variadic)
* - [ConstRef](#constref)
* - [Yield](#yield)
* - [YieldFrom](#yieldfrom)
* - [Print](#print)
* - [Isset](#isset)
* - [Empty](#empty)
* - [Lookup](#lookup)
* - [PropertyLookup](#propertylookup)
* - [StaticLookup](#staticlookup)
Expand All @@ -57,42 +68,33 @@ const Position = require("./ast/position");
* - [Nowdoc](#nowdoc)
* - [Encapsed](#encapsed)
* - [Statement](#statement)
* - [Eval](#eval)
* - [Exit](#exit)
* - [Return](#return)
* - [Label](#label)
* - [Continue](#continue)
* - [Case](#case)
* - [Break](#break)
* - [Echo](#echo)
* - [Unset](#unset)
* - [Halt](#halt)
* - [Clone](#clone)
* - [Declare](#declare)
* - [Global](#global)
* - [Static](#static)
* - [Include](#include)
* - [Assign](#assign)
* - [RetIf](#retif)
* - [If](#if)
* - [Do](#do)
* - [While](#while)
* - [For](#for)
* - [Foreach](#foreach)
* - [Switch](#switch)
* - [Goto](#goto)
* - [Silent](#silent)
* - [Try](#try)
* - [Catch](#catch)
* - [Throw](#throw)
* - [Call](#call)
* - [Closure](#closure)
* - [New](#new)
* - [UseGroup](#usegroup)
* - [UseItem](#useitem)
* - [Block](#block)
* - [Program](#program)
* - [Namespace](#namespace)
* - [Sys](#sys)
* - [Echo](#echo)
* - [List](#list)
* - [Print](#print)
* - [Isset](#isset)
* - [Unset](#unset)
* - [Empty](#empty)
* - [Declaration](#declaration)
* - [Class](#class)
* - [Interface](#interface)
Expand Down Expand Up @@ -416,7 +418,6 @@ AST.prototype.prepare = function(kind, docs, parser) {
require("./ast/staticreference"),
require("./ast/string"),
require("./ast/switch"),
require("./ast/sys"),
require("./ast/throw"),
require("./ast/trait"),
require("./ast/traitalias"),
Expand Down
8 changes: 4 additions & 4 deletions src/ast/assign.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@
*/
"use strict";

const Statement = require("./statement");
const Expression = require("./expression");
const KIND = "assign";

/**
* Assigns a value to the specified target
* @constructor Assign
* @extends {Statement}
* @extends {Expression}
* @property {Expression} left
* @property {Expression} right
* @property {String} operator
*/
module.exports = Statement.extends(KIND, function Assign(
module.exports = Expression.extends(KIND, function Assign(
left,
right,
operator,
docs,
location
) {
Statement.apply(this, [KIND, docs, location]);
Expression.apply(this, [KIND, docs, location]);
this.operator = operator;
this.left = left;
this.right = right;
Expand Down
8 changes: 4 additions & 4 deletions src/ast/break.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
*/
"use strict";

const Node = require("./node");
const Statement = require("./statement");
const KIND = "break";

/**
* A break statement
* @constructor Break
* @extends {Node}
* @extends {Statement}
* @property {Number|Null} level
*/
module.exports = Node.extends(KIND, function Break(level, docs, location) {
Node.apply(this, [KIND, docs, location]);
module.exports = Statement.extends(KIND, function Break(level, docs, location) {
Statement.apply(this, [KIND, docs, location]);
this.level = level;
});
8 changes: 4 additions & 4 deletions src/ast/call.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
*/
"use strict";

const Statement = require("./statement");
const Expression = require("./expression");
const KIND = "call";

/**
* Executes a call statement
* @constructor Call
* @extends {Statement}
* @extends {Expression}
* @property {Identifier|Variable|??} what
* @property {Arguments[]} arguments
*/
module.exports = Statement.extends(KIND, function Call(
module.exports = Expression.extends(KIND, function Call(
what,
args,
docs,
location
) {
Statement.apply(this, [KIND, docs, location]);
Expression.apply(this, [KIND, docs, location]);
this.what = what;
this.arguments = args;
});
13 changes: 9 additions & 4 deletions src/ast/case.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,23 @@
*/
"use strict";

const Node = require("./node");
const Statement = require("./statement");
const KIND = "case";

/**
* A switch case statement
* @constructor Case
* @extends {Node}
* @extends {Statement}
* @property {Expression|null} test - if null, means that the default case
* @property {Block|null} body
*/
module.exports = Node.extends(KIND, function Case(test, body, docs, location) {
Node.apply(this, [KIND, docs, location]);
module.exports = Statement.extends(KIND, function Case(
test,
body,
docs,
location
) {
Statement.apply(this, [KIND, docs, location]);
this.test = test;
this.body = body;
});
2 changes: 1 addition & 1 deletion src/ast/classreference.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const KIND = "classreference";
/**
* Defines a class reference node
* @constructor ClassReference
* @extends {Node}
* @extends {Reference}
* @property {string} name
* @property {string} resolution
*/
Expand Down
8 changes: 4 additions & 4 deletions src/ast/clone.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
*/
"use strict";

const Statement = require("./statement");
const Expression = require("./expression");
const KIND = "clone";

/**
* Defines a clone call
* @constructor Clone
* @extends {Statement}
* @extends {Expression}
* @property {Expression} what
*/
module.exports = Statement.extends(KIND, function Clone(what, docs, location) {
Statement.apply(this, [KIND, docs, location]);
module.exports = Expression.extends(KIND, function Clone(what, docs, location) {
Expression.apply(this, [KIND, docs, location]);
this.what = what;
});
12 changes: 8 additions & 4 deletions src/ast/continue.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@
*/
"use strict";

const Node = require("./node");
const Statement = require("./statement");
const KIND = "continue";

/**
* A continue statement
* @constructor Continue
* @extends {Node}
* @extends {Statement}
* @property {Number|Null} level
*/
module.exports = Node.extends(KIND, function Continue(level, docs, location) {
Node.apply(this, [KIND, docs, location]);
module.exports = Statement.extends(KIND, function Continue(
level,
docs,
location
) {
Statement.apply(this, [KIND, docs, location]);
this.level = level;
});
11 changes: 6 additions & 5 deletions src/ast/echo.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@
*/
"use strict";

const Sys = require("./sys");
const Statement = require("./statement");
const KIND = "echo";

/**
* Defines system based call
* @constructor Echo
* @property {boolean} shortForm
* @extends {Sys}
* @extends {Statement}
*/
module.exports = Sys.extends(KIND, function Echo(
args,
module.exports = Statement.extends(KIND, function Echo(
expressions,
shortForm,
docs,
location
) {
Sys.apply(this, [KIND, args, docs, location]);
Statement.apply(this, [KIND, docs, location]);
this.shortForm = shortForm;
this.expressions = expressions;
});
13 changes: 9 additions & 4 deletions src/ast/empty.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@
*/
"use strict";

const Sys = require("./sys");
const Expression = require("./expression");
const KIND = "empty";

/**
* Defines an empty check call
* @constructor Empty
* @extends {Sys}
* @extends {Expression}
*/
module.exports = Sys.extends(KIND, function Empty(args, docs, location) {
Sys.apply(this, [KIND, args, docs, location]);
module.exports = Expression.extends(KIND, function Empty(
expression,
docs,
location
) {
Expression.apply(this, [KIND, docs, location]);
this.expression = expression;
});
12 changes: 8 additions & 4 deletions src/ast/eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@
*/
"use strict";

const Statement = require("./statement");
const Expression = require("./expression");
const KIND = "eval";

/**
* Defines an eval statement
* @constructor Eval
* @extends {Statement}
* @extends {Expression}
* @property {Node} source
*/
module.exports = Statement.extends(KIND, function Eval(source, docs, location) {
Statement.apply(this, [KIND, docs, location]);
module.exports = Expression.extends(KIND, function Eval(
source,
docs,
location
) {
Expression.apply(this, [KIND, docs, location]);
this.source = source;
});
8 changes: 4 additions & 4 deletions src/ast/exit.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
*/
"use strict";

const Statement = require("./statement");
const Expression = require("./expression");
const KIND = "exit";

/**
* Defines an exit / die call
* @constructor Exit
* @extends {Statement}
* @extends {Expression}
* @property {Node|null} status
* @property {Boolean} useDie
*/
module.exports = Statement.extends(KIND, function Exit(
module.exports = Expression.extends(KIND, function Exit(
status,
useDie,
docs,
location
) {
Statement.apply(this, [KIND, docs, location]);
Expression.apply(this, [KIND, docs, location]);
this.status = status;
this.useDie = useDie;
});
8 changes: 4 additions & 4 deletions src/ast/include.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@
*/
"use strict";

const Statement = require("./statement");
const Expression = require("./expression");
const KIND = "include";

/**
* Defines system include call
* @constructor Include
* @extends {Statement}
* @extends {Expression}
* @property {Node} target
* @property {boolean} once
* @property {boolean} require
*/
module.exports = Statement.extends(KIND, function Include(
module.exports = Expression.extends(KIND, function Include(
once,
require,
target,
docs,
location
) {
Statement.apply(this, [KIND, docs, location]);
Expression.apply(this, [KIND, docs, location]);
this.once = once;
this.require = require;
this.target = target;
Expand Down
Loading

0 comments on commit fdffbd1

Please sign in to comment.