Sign in

    moonrockz/gleam-parser/dialect does not have a README file

    Dialect

    pub(all) struct Dialect {
    name : String
    keywords : ArrayView[String]
    attributes : ArrayView[String]
    targets : ArrayView[String]
    deprecations : ArrayView[Rule]
    } derive(Eq,
    Debug
    )

    What the parser accepts: the reserved words, the attribute names (@external, …), the target names, and the deprecated syntax it warns about. Dialect::gleam_1_19() is the default and the only built-in.

    test {
    let d = @dialect.Dialect::gleam_1_19()
    inspect(d.knows_attribute("deprecated"), content="true")
    inspect(d.warns(DeprecatedListPrepend), content="true")
    }

    Dialect::from_version

    fn Dialect::from_version(version : String) -> Dialect?

    The built-in dialect for a Gleam version ("1.19"), or None.

    test {
    debug_inspect(
    @dialect.Dialect::from_version("1.19").map(d => d.version()),
    content="Some(\"1.19\")",
    )
    }

    Dialect::gleam_1_19

    fn Dialect::gleam_1_19() -> Dialect

    Gleam 1.19: the compiler's 22 reserved words, the four attributes, the two targets, and every deprecation warning on.

    Dialect::known_versions

    fn Dialect::known_versions() -> Array[String]

    The Gleam versions with a built-in dialect, as from_version reads them.

    Dialect::knows_attribute

    fn Dialect::knows_attribute(self : Dialect, name : String) -> Bool

    Dialect::knows_target

    fn Dialect::knows_target(self : Dialect, name : String) -> Bool

    Dialect::version

    fn Dialect::version(self : Dialect) -> String

    The Gleam version this dialect follows ("1.19" for gleam-1.19).

    Dialect::warns

    fn Dialect::warns(self : Dialect, rule : Rule) -> Bool

    Rule

    pub(all) enum Rule {
    DeprecatedListPrepend
    DeprecatedListPattern
    DeprecatedListCatchAllPattern
    DeprecatedListSpreadAsVariablePattern
    DeprecatedRecordSpreadPattern
    DeprecatedEmptyClauseGuard
    DeprecatedTargetShorthand
    } derive(Eq, Hash,
    Debug
    )

    A deprecated-syntax rule the parser warns about: one per kind of the compiler's DeprecatedSyntaxWarning.

    Rule::all

    fn Rule::all() -> Array[Rule]

    Rule::name

    fn Rule::name(self : Rule) -> String

    The rule's name, as a diagnostic names it.

    Source Files