/** * Scope References * * Enum used to define scopes, which are * keyword values that hold assigned values. */ export const enum Scopes { /** * Unknown Scope * * This infers that the value has no known * scope or reference. * * @example * {% assign foo = 'xx' %} * * {{ foo }} // foo will have a string scope * {{ bar }} // bar is not known, ie: unknown */ Unknown, /** * Object Scope * * This infers that the value holds an object * or property value scope * * @example * {% assign foo = object.property %} * * {{ foo }} // foo will point to object.property */ Object, /** * String Scope * * This infers that the value holds a string type * scope. * * @example * {% assign foo = 'xx' %} * * {{ foo }} // foo holds 'xx' (string) */ String, /** * Number Scope * * This infers that the value holds a numeric type * scope * * @example * {% assign foo = 100 %} * * {{ foo }} // foo holds 100 (number) */ Number, /** * Array Scope * * This infers that the value holds a reference to an * array type scope value. Array scopes are also asserted * when an assignment ends with a `split` filter * * @example * {% assign foo = object.list %} * {% assign bar = 'one,two,three' | split: ',' %} * * {{ foo }} // foo points to an object value which is an array * {{ bar }} // bar points to an assignment that ends with split * * // CASES * * {{ foo.xx }} // This will not work and error will occur. * {{ foo[0] }} // This will succeed as it uses an index ref. */ Array, /** * Boolean Scope * * This infers that the value holds a boolean type * scope * * @example * {% assign foo = false %} * * {{ foo }} // foo holds false (boolean) */ Boolean } export const enum Types { /** * **BASIC TYPE** * * Any Type * * Asserts any type on an argument, this is the * default. When a token uses this type alphanumeric * character sequences are consumed. * * --- * * **Examples** * * When an _any_ type is present the parser will * consume the argument and not run any validation. * * --- */ Any = 1, /** * **BASIC TYPE** * * Object types represent a token which has properties. * When a spec uses this type it is expected to have * additional values. * * --- * * **Example** * * - `object.prop` * - `object['prop']` * * --- * */ Object, /** * **BASIC TYPE** * * A value that is a digit integer type. It assumes * a negative number (without decimal point) or basic * number (without decimal point). * * --- * * **Example** * * - `25` * - `1000` * * --- * */ Number, /** * **BASIC TYPE** * * A value that is a digit integer or float type. It * will assume one or the other. * * --- * * **Example** * * - `25` * - `-39.756` * * --- * */ Float, /** * **BASIC TYPE** * * Boolean type represents a word boolean value, but can also * represent additional word values as follows: * * --- * * **Example** * * - `true` * - `false` * - `nil` * - `empty` * * --- * */ Boolean, /** * **BASIC TYPE** * * Refers to token value surrounded by quotation characters. * * --- * * **Example** * * - `'string'` * - `"string"` * * --- */ String, /** * **BASIC TYPE** * * Array types are used to describe a Liquid value object * which holds an array (collection) value, for example: * * --- * * **Example** * * You would assert an _array_ type when the token requires * such an input to correctly operate, for example an array * is required to be past in the for tag. * * - `{% for i in array %}` * - `{{ array | uniq }}` * * --- * */ Array, /** * **BASIC TYPE** * * Constant Type * * Constant types described a value which contains no properties * and outputs data, likely to be globals, like that you would * encounter with `content_for_header` in shopify. * * --- * * **Example** * * - `{{ content_for_header }}` * * --- * */ Constant, } export const enum Argument { /** * **ARGUMENT TYPE** * * Refers to a Liquid parameter which is a * alphanumeric - colon token combination. * * --- * * **Example** * * - `param:` * - `some_param:` * - `param_1:` * * --- */ Parameter, /** * **ARGUMENT TYPE** * * Keyword Type * * Refers to word that will either hold or be assigned a value, * it cannot contain any characters other than letters and numbers. * When used with `value` the parser will assume an idententical * match is required. * * --- * * **Example** * * Keyword types can be used to describe an iterator token of * a `for` tag or the variable defined in a capture or assign tag. * In the Shopify specs a keyword is defined as a _type_ on the * `paginate` tag when decribing the `by` operator value. * * - `{% assign keyword = 'foo' %}` * - `{% for keyword in array %}` * * --- */ Keyword, /** * **ARGUMENT TYPE** * * Refers to a HTML or Liquid which is a * alphanumeric - equal token combination. * * --- * * **Example** * * - `attr=` * - `key=` * * --- */ Attribute, } export const enum Tags { /** * **TAG TYPE** * * Control Type * * Control types use curly brace and percent delimiters. * Their keyword is defined by their specification. These tags * are used in conditional execution of code. * * --- * * Variations: * * - Standard * - Shopify * - Jekyll * - Eleventy * * --- * * Examples: * * - `{% if %}` * - `{% unless %}` * - `{% else %}` */ Control, /** * **TAG TYPE** * * Comment Type * * Comment types can be either of Liquid or HTML kinds. * They are either defined by their specification or their * delimiter characters. The represent a comment. * * --- * * Variations: * * - Standard * - Shopify * - Jekyll * - Eleventy * * --- * * Examples: * * - `{% comment %} {% endcomment %}` * - `{% # comment %}` * - `` */ Comment, /** * **TAG TYPE** * * Embedded Type * * Import types can use different (see: _kinds_ enums) of * delimiters. They are either defined by their specification, * their delimiter character or associate type. The * inner contents of these tags contain different languages. * * --- * * Variations: * * - Shopify * - Jekyll * - Eleventy * * --- * * Examples: * * - `{% schema %}` * - `{% style %}` * - `