type

SyntaxRules

src @Js
@Serializable
const class SyntaxRules : Obj

SyntaxRules defines the syntax rules used to parse a specific programming language.

constructors

make

Default constructor with it-block

fields

blockCommentEnd

End token for multi-line block comments

blockCommentStart

Start token for multi-line block comments

blockCommentsNest

Can block comments be nested (default is false).

brackets

Bracket characters defaults to "()[]{}".

comments

Start tokens for single line comments to end of line (list of strings).

keywords

List of the keywords.

strs

String and character literal styles

methods

loadForExt

Load syntax rules for given file extension using "etc/syntax/ext.props".

loadForFile

Load syntax rules for given file.

Slot Details

blockCommentEnd

src const Str? blockCommentEnd

End token for multi-line block comments

blockCommentStart

src const Str? blockCommentStart

Start token for multi-line block comments

blockCommentsNest

src const Bool blockCommentsNest := false

Can block comments be nested (default is false).

brackets

src const Str brackets := "(){}[]"

Bracket characters defaults to "()[]{}".

comments

src const Str[]? comments

Start tokens for single line comments to end of line (list of strings).

keywords

src const Str[]? keywords

List of the keywords.

loadForExt

src static SyntaxRules? loadForExt(Str ext)

Load syntax rules for given file extension using "etc/syntax/ext.props". If no rules defined for extension return null.

loadForFile

src static SyntaxRules? loadForFile(File file, Str? firstLine := null)

Load syntax rules for given file. If the file has already been parse then pass the first line to avoid re-reading the file to check the "#!" shebang. First we attempt to map the file extension to rules. If that fails, then we check the first line to see if defines a "#!" shebang. Return null if no rules can be determined.

make

src new make(|This|? f := null)

Default constructor with it-block

strs

src const SyntaxStr[]? strs

String and character literal styles