123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 |
- export class Program {
- constructor() {
- this.body = [];
- this.isProgram = true;
- }
- }
- export class VariableDeclaration {
- constructor( type, name, value = null, next = null, immutable = false ) {
- this.type = type;
- this.name = name;
- this.value = value;
- this.next = next;
- this.immutable = immutable;
- this.isVariableDeclaration = true;
- }
- }
- export class Uniform {
- constructor( type, name ) {
- this.type = type;
- this.name = name;
- this.isUniform = true;
- }
- }
- export class Varying {
- constructor( type, name ) {
- this.type = type;
- this.name = name;
- this.isVarying = true;
- }
- }
- export class FunctionParameter {
- constructor( type, name, qualifier = null, immutable = true ) {
- this.type = type;
- this.name = name;
- this.qualifier = qualifier;
- this.immutable = immutable;
- this.isFunctionParameter = true;
- }
- }
- export class FunctionDeclaration {
- constructor( type, name, params = [] ) {
- this.type = type;
- this.name = name;
- this.params = params;
- this.body = [];
- this.isFunctionDeclaration = true;
- }
- }
- export class Expression {
- constructor( expression ) {
- this.expression = expression;
- this.isExpression = true;
- }
- }
- export class Ternary {
- constructor( cond, left, right ) {
- this.cond = cond;
- this.left = left;
- this.right = right;
- this.isTernary = true;
- }
- }
- export class Operator {
- constructor( type, left, right ) {
- this.type = type;
- this.left = left;
- this.right = right;
- this.isOperator = true;
- }
- }
- export class Unary {
- constructor( type, expression, after = false ) {
- this.type = type;
- this.expression = expression;
- this.after = after;
- this.isUnary = true;
- }
- }
- export class Number {
- constructor( value, type = 'float' ) {
- this.type = type;
- this.value = value;
- this.isNumber = true;
- }
- }
- export class String {
- constructor( value ) {
- this.value = value;
- this.isString = true;
- }
- }
- export class Conditional {
- constructor( cond = null ) {
- this.cond = cond;
- this.body = [];
- this.elseConditional = null;
- this.isConditional = true;
- }
- }
- export class FunctionCall {
- constructor( name, params = [] ) {
- this.name = name;
- this.params = params;
- this.isFunctionCall = true;
- }
- }
- export class Return {
- constructor( value ) {
- this.value = value;
- this.isReturn = true;
- }
- }
- export class Discard {
- constructor() {
- this.isDiscard = true;
- }
- }
- export class Accessor {
- constructor( property ) {
- this.property = property;
- this.isAccessor = true;
- }
- }
- export class StaticElement {
- constructor( value ) {
- this.value = value;
- this.isStaticElement = true;
- }
- }
- export class DynamicElement {
- constructor( value ) {
- this.value = value;
- this.isDynamicElement = true;
- }
- }
- export class AccessorElements {
- constructor( object, elements = [] ) {
- this.object = object;
- this.elements = elements;
- this.isAccessorElements = true;
- }
- }
- export class For {
- constructor( initialization, condition, afterthought ) {
- this.initialization = initialization;
- this.condition = condition;
- this.afterthought = afterthought;
- this.body = [];
- this.isFor = true;
- }
- }
|