Skip to the content.

Language Matcher Schema

#/languageMatcher

Language parser grammar

Abstract Extensible Status Identifiable Custom Properties Additional Properties Defined In
Can be instantiated No Experimental No Forbidden Forbidden LanguageMatcherDefinition.schema.json

Language Matcher Properties

Property Type Required Nullable Default Defined by
actions array Optional No   Language Matcher (this schema)
fragments object[] Required No   Language Matcher (this schema)
indexingMode enum Optional No "Lazy" Language Matcher (this schema)
logMatches boolean Required No false Language Matcher (this schema)
name string Required No   Language Matcher (this schema)
patterns array Required No   Language Matcher (this schema)
startingFragment string Required No   Language Matcher (this schema)

actions

actions

actions Type

Array type: array

All items must be of the type:

One of the following conditions need to be fulfilled.

Condition 1

object with following properties:

Property Type Required
action string Required
firstVariableName string Required
name string Required
source string Required
value integer,string Optional

action

Action type

action

The value of this property must be equal to one of the known values below.

action Known Values
Value Description
CreateVariable  

firstVariableName

Name of variable to create

firstVariableName

firstVariableName Type

string

All instances must conform to this regular expression

^(\w+)$
firstVariableName Example
Var1

name

Action reference name

name

name Type

string

All instances must conform to this regular expression

^(\w+)$
name Example
CreateVar

source

Value to set in the variable

source

The value of this property must be equal to one of the known values below.

source Known Values
Value Description
Value Use the value field
PartsCount Count of fragment parts
PartsXml XML representation of the fragment parts
PartsLength Length of all fragment parts together
StringPartsText Count of fragment string based parts
StringPartsLength Concatenated text of all fragment string based parts

value

Value to set in the variable if this is set as the source

value

value Type

Unknown type integer,string.

{
  "$id": "#/properties/actions/items/properties/createVariable/value",
  "type": ["integer", "string"],
  "description": "Value to set in the variable if this is set as the source",
  "examples": ["print", 20],
  "simpletype": "multiple"
}
value Examples
print
20

Condition 2

object with following properties:

Property Type Required
action string Required
change string Required
firstVariableName string Required
name string Required
secondVariableName string Required

action

Action type

action

The value of this property must be equal to one of the known values below.

action Known Values
Value Description
UpdateVariable  

change

Operation to perform

change

The value of this property must be equal to one of the known values below.

change Known Values
Value Description
Add  
Subtract  
Concat  
Remove  
Set  

firstVariableName

Name of variable to update and perform a operation against

firstVariableName

firstVariableName Type

string

All instances must conform to this regular expression

^(\w+)$
firstVariableName Example
Var1

name

Action reference name

name

name Type

string

All instances must conform to this regular expression

^(\w+)$
name Example
SetVar

secondVariableName

Name of variable to use on the other end of the operation

secondVariableName

secondVariableName Type

string

All instances must conform to this regular expression

^(\w+)$
secondVariableName Example
Var2

Condition 3

object with following properties:

Property Type Required
action string Required
assert string Required
firstVariableName string Required
name string Required
secondVariableName string Required

action

Action type

action

The value of this property must be equal to one of the known values below.

action Known Values
Value Description
Assert  

assert

The condition to assert between the two variables

assert

The value of this property must be equal to one of the known values below.

assert Known Values
Value Description
MatchesPattern Matches a pattern string (e.g. \w+)
Equals  
NotEquals  
GreaterThan  
GreaterThanOrEquals  
LessThan  
LessThanOrEquals  
Contains  
StartsWith  
EndsWith  

firstVariableName

Name of the first variable in the condition

firstVariableName

firstVariableName Type

string

All instances must conform to this regular expression

^(\w+)$
firstVariableName Example
Var1

name

Action reference name

name

name Type

string

All instances must conform to this regular expression

^(\w+)$
name Example
CheckVar

secondVariableName

Name of the second variable in the condition

secondVariableName

secondVariableName Type

string

All instances must conform to this regular expression

^(\w+)$
secondVariableName Example
Var2

fragments

Text parsing rules

fragments

fragments Type

Array type: object[]

All items must be of the type: object with following properties:

Property Type Required Default
actions array Optional  
boundsAsParts boolean Optional false
cacheable boolean Optional false
clearCache boolean Optional false
discardBounds boolean Optional false
end string Optional  
expressionMode string Optional "None"
expressionOrder integer Optional  
fallThroughMode string Optional "None"
isNoise boolean Optional false
minMatchedParts integer Optional  
name string Required  
negate boolean Optional false
parts array Required  
partsDelimiter string Optional  
partsDelimiterRequired boolean Optional true
partsMatchMode string Optional "Multiple"
partsPadding string Optional  
start string Optional  

actions

actions

actions Type

Array type: string[]

All items must be of the type: string

All instances must conform to this regular expression

^(\w+)$

Name of actions to run if the fragment matched successfully

boundsAsParts

Add the matched start and end patterns as parts

boundsAsParts

boundsAsParts Type

boolean

cacheable

Store the match result of this fragment to avoid the need to match against the same text segment again

cacheable

cacheable Type

boolean

clearCache

Clear the cache if successfully matched

clearCache

clearCache Type

boolean

discardBounds

Start and end patterns do not move the read cursor

discardBounds

discardBounds Type

boolean

end

Name of the pattern that marks the end of the fragment. Match not added to the AST by default

end

end Type

string

All instances must conform to this regular expression

^(\w+)$
end Example
CloseBracket

expressionMode

Expression parser mode

expressionMode

The value of this property must be equal to one of the known values below.

expressionMode Known Values
Value Description
None No expression parsing
BinaryTree Expression tree to have a max of two child parts per node
LikeNameTree Expression tree combines parts that are the same type

expressionOrder

Expression precedence within parent (lower number is higher precedence)

expressionOrder

expressionOrder Type

integer

fallThroughMode

Add the children of this fragment instead of this fragment to the AST, and discard this fragment

fallThroughMode

The value of this property must be equal to one of the known values below.

fallThroughMode Known Values
Value Description
None No fall through
Empty Fall through if there are no children
One Fall through if there is one or less child
All Always fall through

isNoise

Do not add this part to the AST

isNoise

isNoise Type

boolean

minMatchedParts

Minimum number of parts that must be matched

minMatchedParts

minMatchedParts Type

integer

name

Fragment reference name

name

name Type

string

All instances must conform to this regular expression

^(\w+)$
name Example
Script

negate

Negate the success or failure of the match

negate

negate Type

boolean

parts

parts

parts Type

Array type: string[]

All items must be of the type: string

All instances must conform to this regular expression

^(\w+|\[\w+\])$

Names of nested fragments (surrounded by ‘[’ and ‘]’) and/or patterns

partsDelimiter

Name of the pattern that separates parts. Match not added to the AST

partsDelimiter

partsDelimiter Type

string

All instances must conform to this regular expression

^(\w+)$
partsDelimiter Example
Whitespace

partsDelimiterRequired

Require that parts are separated by the delimiter

partsDelimiterRequired

partsDelimiterRequired Type

boolean

partsMatchMode

Repetition constraint

partsMatchMode

The value of this property must be equal to one of the known values below.

partsMatchMode Known Values
Value Description
Multiple Match any of the parts (one or more)
Ordered Match the parts in the order given
One Match one of the parts

partsPadding

Name of the pattern that bounds the parts. Match not added to the AST

partsPadding

partsPadding Type

string

All instances must conform to this regular expression

^(\w+)$
partsPadding Example
Whitespace

start

Name of the pattern that marks the beginning of the fragment. Match not added to the AST by default

start

start Type

string

All instances must conform to this regular expression

^(\w+)$
start Example
OpenBracket

Text parsing rule

indexingMode

Token indexing configuration (lexing)

indexingMode

The value of this property must be equal to one of the known values below.

indexingMode Known Values

Value Description
None Disable lexing
Lazy Generate tokens on demand
Eager Generate tokens before parsing

indexingMode Example

"Eager"

logMatches

Log fragment and pattern match successes and failures while parsing text

logMatches

logMatches Type

boolean

name

The name of the language

name

name Type

string

All instances must conform to this regular expression

^(\w+)$

name Example

"Lua"

patterns

patterns

patterns Type

Array type: array

All items must be of the type:

One of the following conditions need to be fulfilled.

Condition 1

object with following properties:

Property Type Required Default
isAuxiliary boolean Optional false
isNoise boolean Optional false
name string Required  
pattern string Required  

isAuxiliary

Pattern won’t be used in pre-parse lexing but may be referenced by a fragment

isAuxiliary

isAuxiliary Type

boolean

isNoise

Text to be ignored while parsing

isNoise

isNoise Type

boolean

name

Pattern reference name

name

name Type

string

All instances must conform to this regular expression

^(\w+)$
name Example
StringLiteral

pattern

Pattern used to parse tokens from text

pattern

pattern Type

string

All instances must conform to this regular expression

^(.*)$
pattern Example
\s+

Condition 2

object with following properties:

Property Type Required Default
isAuxiliary boolean Optional false
isNoise boolean Optional false
name string Required  
pattern string Optional  

isAuxiliary

Pattern won’t be used in pre-parse lexing but may be referenced by a fragment

isAuxiliary

isAuxiliary Type

boolean

isNoise

Text to be ignored while parsing

isNoise

isNoise Type

boolean

name

Pattern reference name

name

name Type

string

All instances must conform to this regular expression

^(\w+)$
name Example
StringLiteral

pattern

Fragment to run during pre-parse lexing

pattern

pattern Type

string

All instances must conform to this regular expression

^(\w+)$
pattern Example
SpecialSection

startingFragment

The fragment to use to begin parsing

startingFragment

startingFragment Type

string

All instances must conform to this regular expression

^(\w+)$

startingFragment Example

"Script"