Skip to content

Commit

Permalink
Merge 374a6c0 into e9a186f
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi committed Nov 2, 2018
2 parents e9a186f + 374a6c0 commit 5967a59
Show file tree
Hide file tree
Showing 60 changed files with 1,568 additions and 299 deletions.
23 changes: 12 additions & 11 deletions src/ast.js
Expand Up @@ -25,19 +25,22 @@ 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)
* - [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,6 +60,13 @@ const Position = require("./ast/position");
* - [Nowdoc](#nowdoc)
* - [Encapsed](#encapsed)
* - [Statement](#statement)
* - [Return](#return)
* - [Label](#label)
* - [Continue](#continue)
* - [Case](#case)
* - [Break](#break)
* - [Echo](#echo)
* - [Unset](#unset)
* - [Eval](#eval)
* - [Exit](#exit)
* - [Halt](#halt)
Expand All @@ -65,7 +75,6 @@ const Position = require("./ast/position");
* - [Global](#global)
* - [Static](#static)
* - [Include](#include)
* - [Assign](#assign)
* - [RetIf](#retif)
* - [If](#if)
* - [Do](#do)
Expand All @@ -86,13 +95,6 @@ const Position = require("./ast/position");
* - [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
6 changes: 3 additions & 3 deletions src/ast/assign.js
Expand Up @@ -5,7 +5,7 @@
*/
"use strict";

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

/**
Expand All @@ -16,14 +16,14 @@ const KIND = "assign";
* @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
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/case.js
Expand Up @@ -5,18 +5,18 @@
*/
"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;
});
8 changes: 4 additions & 4 deletions src/ast/continue.js
Expand Up @@ -5,16 +5,16 @@
*/
"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
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
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;
});
13 changes: 9 additions & 4 deletions src/ast/isset.js
Expand Up @@ -5,14 +5,19 @@
*/
"use strict";

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

/**
* Defines an isset call
* @constructor Isset
* @extends {Sys}
* @extends {Expression}
*/
module.exports = Sys.extends(KIND, function Isset(args, docs, location) {
Sys.apply(this, [KIND, args, docs, location]);
module.exports = Expression.extends(KIND, function Isset(
variables,
docs,
location
) {
Expression.apply(this, [KIND, docs, location]);
this.variables = variables;
});
8 changes: 4 additions & 4 deletions src/ast/label.js
Expand Up @@ -5,16 +5,16 @@
*/
"use strict";

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

/**
* A label statement (referenced by goto)
* @constructor Label
* @extends {Node}
* @extends {Statement}
* @property {String} name
*/
module.exports = Node.extends(KIND, function Label(name, docs, location) {
Node.apply(this, [KIND, docs, location]);
module.exports = Statement.extends(KIND, function Label(name, docs, location) {
Statement.apply(this, [KIND, docs, location]);
this.name = name;
});
9 changes: 5 additions & 4 deletions src/ast/list.js
Expand Up @@ -5,21 +5,22 @@
*/
"use strict";

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

/**
* Defines list assignment
* @constructor List
* @extends {Sys}
* @extends {Expression}
* @property {boolean} shortForm
*/
module.exports = Sys.extends(KIND, function List(
module.exports = Expression.extends(KIND, function List(
items,
shortForm,
docs,
location
) {
Sys.apply(this, [KIND, items, docs, location]);
Expression.apply(this, [KIND, docs, location]);
this.items = items;
this.shortForm = shortForm;
});
13 changes: 9 additions & 4 deletions src/ast/print.js
Expand Up @@ -5,14 +5,19 @@
*/
"use strict";

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

/**
* Outputs
* @constructor Print
* @extends {Sys}
* @extends {Expression}
*/
module.exports = Sys.extends(KIND, function Print(args, docs, location) {
Sys.apply(this, [KIND, args, docs, location]);
module.exports = Expression.extends(KIND, function Print(
expression,
docs,
location
) {
Expression.apply(this, [KIND, docs, location]);
this.expression = expression;
});
8 changes: 4 additions & 4 deletions src/ast/return.js
Expand Up @@ -5,16 +5,16 @@
*/
"use strict";

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

/**
* A continue statement
* @constructor Return
* @extends {Node}
* @extends {Statement}
* @property {Expression|null} expr
*/
module.exports = Node.extends(KIND, function Return(expr, docs, location) {
Node.apply(this, [KIND, docs, location]);
module.exports = Statement.extends(KIND, function Return(expr, docs, location) {
Statement.apply(this, [KIND, docs, location]);
this.expr = expr;
});
25 changes: 0 additions & 25 deletions src/ast/sys.js

This file was deleted.

13 changes: 9 additions & 4 deletions src/ast/unset.js
Expand Up @@ -5,14 +5,19 @@
*/
"use strict";

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

/**
* Deletes references to a list of variables
* @constructor Unset
* @extends {Sys}
* @extends {Statement}
*/
module.exports = Sys.extends(KIND, function Unset(args, docs, location) {
Sys.apply(this, [KIND, args, docs, location]);
module.exports = Statement.extends(KIND, function Unset(
variables,
docs,
location
) {
Statement.apply(this, [KIND, docs, location]);
this.variables = variables;
});

0 comments on commit 5967a59

Please sign in to comment.