Implementation
To customize you should extract tokens with regular expression. Then you should create the template of original language with token you extracted.
Token Extraction
Syntax
typeofsyntax
Name of syntax you wanted to match
Eg. arithmetic, loop etc.
If one type have same pattern but different regular expression to match.
You can write _<any character><typeofsyntax>
for next regex.
Eg. _1typeofsyntax
Both regex use one template
regex
Place where regular expression to match block of code..
Regular expression for tokens must be inside brackets.
~
acts like s*
in regular expression
tokens
Name of tokens you wanted to extract
unmatch
List of regex that should not be matched. It can be used in token option also
global
If it is False it works only after calling it otherwise it works normally.
once
If it is True it works only once
next
To pass converted syntax into another or same typeofsyntax
token1
To modify token1 matched
To add content in each line.
<line>
represents original content in eachline. It loops through every line.
settings block
For setting variables, collections, after command
You can make variables than can used inside regular expression by <varname>
Example
Template
Template of syntax of target language
Syntax
typeofsyntax - Name of typeofsyntax in token extraction file.
token1,token2,token3 - Represents tokens extracted with regular expression in token extraction file.
Write tokens inside template of original language(<tokename>
)
Example
Linting
To match error with regular expression.
If error is matched, part of code with error and error message will be displayed.
Syntax
Syntax of error file
typeofsyntax Block
Block name is name of typeofsyntax in token extraction file. Regex is only matched inside text matched by main regex.
Outside Block
To match error regex in whole source code.
For errors related to a typeofsyntax, outside block should be inside typeofsyntax block.
For errors not related to any typeofsyntax, outside block should be used outside block
NameofError
Name of the error you want to match
Eg. TypeError, Syntax Error etc.
Regex
Regular expression to match error part of code
Error Message
Details of error
Help Message (optional)
Steps to resolve the error
Example
You can share your syntax in LangTrans Repos
Last updated