Repository: tree-sitter/tree-sitter-haskell Branch: master Commit: 0975ef72fc3c Files: 101 Total size: 20.2 MB Directory structure: gitextract_gnpzepxr/ ├── .editorconfig ├── .gitattributes ├── .github/ │ └── workflows/ │ ├── ci.yml │ ├── fuzz.yml │ └── publish.yml ├── .gitignore ├── CMakeLists.txt ├── Cargo.toml ├── LICENSE ├── Makefile ├── Package.resolved ├── Package.swift ├── README.md ├── binding.gyp ├── bindings/ │ ├── c/ │ │ ├── tree-sitter-haskell.h │ │ └── tree-sitter-haskell.pc.in │ ├── go/ │ │ ├── binding.go │ │ └── binding_test.go │ ├── node/ │ │ ├── binding.cc │ │ ├── binding_test.js │ │ ├── index.d.ts │ │ └── index.js │ ├── python/ │ │ ├── tests/ │ │ │ └── test_binding.py │ │ └── tree_sitter_haskell/ │ │ ├── __init__.py │ │ ├── __init__.pyi │ │ ├── binding.c │ │ └── py.typed │ ├── rust/ │ │ ├── build.rs │ │ └── lib.rs │ └── swift/ │ ├── TreeSitterHaskell/ │ │ └── haskell.h │ └── TreeSitterHaskellTests/ │ └── TreeSitterHaskellTests.swift ├── examples/ │ └── Basic.hs ├── go.mod ├── go.sum ├── grammar/ │ ├── class.js │ ├── conflicts.js │ ├── context.js │ ├── data.js │ ├── decl.js │ ├── exp.js │ ├── externals.js │ ├── general.js │ ├── id.js │ ├── inline.js │ ├── lexeme.js │ ├── literal.js │ ├── module.js │ ├── operator.js │ ├── pat.js │ ├── patsyn.js │ ├── precedences.js │ ├── th.js │ ├── type.js │ └── util.js ├── grammar.js ├── package.json ├── pyproject.toml ├── queries/ │ ├── highlights.scm │ ├── injections.scm │ └── locals.scm ├── setup.py ├── src/ │ ├── grammar.json │ ├── node-types.json │ ├── parser.c │ ├── scanner.c │ ├── tree_sitter/ │ │ ├── alloc.h │ │ ├── array.h │ │ └── parser.h │ └── unicode.h ├── test/ │ └── corpus/ │ ├── char.txt │ ├── class.txt │ ├── comment.txt │ ├── consym.txt │ ├── context.txt │ ├── cpp.txt │ ├── data.txt │ ├── decl.txt │ ├── default.txt │ ├── exp.txt │ ├── family.txt │ ├── foreign.txt │ ├── gadt.txt │ ├── id.txt │ ├── implicit.txt │ ├── import.txt │ ├── instance.txt │ ├── layout.txt │ ├── module.txt │ ├── newtype.txt │ ├── number.txt │ ├── pat.txt │ ├── patsyn.txt │ ├── pragma.txt │ ├── prec.txt │ ├── signature.txt │ ├── special.txt │ ├── string.txt │ ├── th.txt │ ├── type.txt │ └── varsym.txt └── tree-sitter.json ================================================ FILE CONTENTS ================================================ ================================================ FILE: .editorconfig ================================================ root = true [*] charset = utf-8 [*.{json,toml,yml,gyp}] indent_style = space indent_size = 2 [*.js] indent_style = space indent_size = 2 [*.scm] indent_style = space indent_size = 2 [*.{c,cc,h}] indent_style = space indent_size = 4 [*.rs] indent_style = space indent_size = 4 [*.{py,pyi}] indent_style = space indent_size = 4 [*.swift] indent_style = space indent_size = 4 [*.go] indent_style = tab indent_size = 8 [Makefile] indent_style = tab indent_size = 8 [parser.c] indent_size = 2 [{alloc,array,parser}.h] indent_size = 2 ================================================ FILE: .gitattributes ================================================ * text=auto eol=lf # Generated source files src/*.json linguist-generated src/parser.c linguist-generated src/tree_sitter/* linguist-generated # C bindings bindings/c/* linguist-generated CMakeLists.txt linguist-generated Makefile linguist-generated # Rust bindings bindings/rust/* linguist-generated Cargo.toml linguist-generated Cargo.lock linguist-generated # Node.js bindings bindings/node/* linguist-generated binding.gyp linguist-generated package.json linguist-generated package-lock.json linguist-generated # Python bindings bindings/python/** linguist-generated setup.py linguist-generated pyproject.toml linguist-generated # Go bindings bindings/go/* linguist-generated go.mod linguist-generated go.sum linguist-generated # Swift bindings bindings/swift/** linguist-generated Package.swift linguist-generated Package.resolved linguist-generated ================================================ FILE: .github/workflows/ci.yml ================================================ name: CI on: push: branches: [master] paths: - grammar.js - src/** - test/** - bindings/** - binding.gyp pull_request: paths: - grammar.js - src/** - test/** - bindings/** - binding.gyp concurrency: group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true jobs: test: name: Test parser runs-on: ${{matrix.os}} strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-14] steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up tree-sitter uses: tree-sitter/setup-action/cli@v1 - name: Set up examples run: |- git clone https://github.com/joshvera/effects examples/effects --single-branch --depth=1 --filter=blob:none git clone https://github.com/PostgRest/postgrest examples/postgrest --single-branch --depth=1 --filter=blob:none git clone https://github.com/GaloisInc/ivory examples/ivory --single-branch --depth=1 --filter=blob:none git clone https://github.com/polysemy-research/polysemy examples/polysemy --single-branch --depth=1 --filter=blob:none git clone https://github.com/github/semantic examples/semantic --single-branch --depth=1 --filter=blob:none git clone https://github.com/haskell/haskell-language-server examples/haskell-language-server --single-branch --depth=1 --filter=blob:none git clone https://github.com/AndrasKovacs/flatparse examples/flatparse --single-branch --depth=1 --filter=blob:none git clone https://github.com/ekmett/lens examples/lens --single-branch --depth=1 --filter=blob:none git clone https://github.com/tek/tsh-test-ghc examples/tsh-test-ghc --single-branch --depth=1 --filter=blob:none - name: Run tests uses: tree-sitter/parser-test-action@v2 with: test-rust: ${{runner.os == 'Linux'}} - name: Parse examples id: examples uses: tree-sitter/parse-action@v4 with: files: | examples/*.hs !exampels/haskell-language-server/test/functional/Symbol.hs !examples/lens/tests/properties.hs !examples/semantic/semantic/test/fixtures/haskell/corpus/function-declarations.A.hs !examples/semantic/semantic/test/fixtures/haskell/corpus/function-declarations.B.hs !examples/semantic/semantic/test/fixtures/haskell/corpus/tempate-haskell.A.hs !examples/semantic/semantic/test/fixtures/haskell/corpus/template-haskell.B.hs !examples/semantic/semantic/test/fixtures/haskell/corpus/algebraic-datatype-declarations.A.hs !examples/semantic/semantic/test/fixtures/haskell/corpus/algebraic-datatype-declarations.B.hs !examples/semantic/semantic/test/fixtures/haskell/corpus/newtype-declaration.A.hs !examples/semantic/semantic/test/fixtures/haskell/corpus/newtype-declaration.B.hs !examples/semantic/semantic/test/fixtures/haskell/corpus/type-synonyms.A.hs !examples/semantic/semantic/test/fixtures/haskell/corpus/type-synonyms.B.hs !examples/polysemy/src/Polysemy/Law.hs !examples/tsh-test-ghc/compiler/GHC/Builtin/PrimOps.hs invalid-files: | !examples/haskell-language-server/test/testdata/FuncTestFail.hs ================================================ FILE: .github/workflows/fuzz.yml ================================================ name: Fuzz Parser on: push: branches: [master] paths: - src/scanner.c pull_request: paths: - src/scanner.c jobs: fuzz: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Run fuzzer uses: tree-sitter/fuzz-action@v4 ================================================ FILE: .github/workflows/publish.yml ================================================ name: Publish packages on: push: tags: ["*"] permissions: contents: write id-token: write attestations: write jobs: github: uses: tree-sitter/workflows/.github/workflows/release.yml@main with: generate: true attestations: true npm: uses: tree-sitter/workflows/.github/workflows/package-npm.yml@main secrets: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} with: generate: true crates: uses: tree-sitter/workflows/.github/workflows/package-crates.yml@main secrets: CARGO_REGISTRY_TOKEN: ${{secrets.CARGO_REGISTRY_TOKEN}} with: generate: true pypi: uses: tree-sitter/workflows/.github/workflows/package-pypi.yml@main secrets: PYPI_API_TOKEN: ${{secrets.PYPI_API_TOKEN}} with: generate: true ================================================ FILE: .gitignore ================================================ # Rust artifacts target/ # Node artifacts build/ prebuilds/ node_modules/ # Swift artifacts .build/ # Go artifacts _obj/ # Python artifacts .venv/ dist/ *.egg-info *.whl # C artifacts *.a *.so *.so.* *.dylib *.dll *.pc # Example dirs /examples/*/ # Grammar volatiles *.wasm *.obj *.o # Archives *.tar.gz *.tgz *.zip ================================================ FILE: CMakeLists.txt ================================================ cmake_minimum_required(VERSION 3.13) project(tree-sitter-haskell VERSION "0.23.1" DESCRIPTION "Haskell grammar for tree-sitter" HOMEPAGE_URL "https://github.com/tree-sitter/tree-sitter-haskell" LANGUAGES C) option(BUILD_SHARED_LIBS "Build using shared libraries" ON) option(TREE_SITTER_REUSE_ALLOCATOR "Reuse the library allocator" OFF) set(TREE_SITTER_ABI_VERSION 14 CACHE STRING "Tree-sitter ABI version") if(NOT ${TREE_SITTER_ABI_VERSION} MATCHES "^[0-9]+$") unset(TREE_SITTER_ABI_VERSION CACHE) message(FATAL_ERROR "TREE_SITTER_ABI_VERSION must be an integer") endif() find_program(TREE_SITTER_CLI tree-sitter DOC "Tree-sitter CLI") add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/src/parser.c" DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/grammar.json" COMMAND "${TREE_SITTER_CLI}" generate src/grammar.json --abi=${TREE_SITTER_ABI_VERSION} WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMMENT "Generating parser.c") add_library(tree-sitter-haskell src/parser.c) if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/scanner.c) target_sources(tree-sitter-haskell PRIVATE src/scanner.c) endif() target_include_directories(tree-sitter-haskell PRIVATE src) target_compile_definitions(tree-sitter-haskell PRIVATE $<$:TREE_SITTER_REUSE_ALLOCATOR> $<$:TREE_SITTER_DEBUG>) set_target_properties(tree-sitter-haskell PROPERTIES C_STANDARD 11 POSITION_INDEPENDENT_CODE ON SOVERSION "${TREE_SITTER_ABI_VERSION}.${PROJECT_VERSION_MAJOR}" DEFINE_SYMBOL "") configure_file(bindings/c/tree-sitter-haskell.pc.in "${CMAKE_CURRENT_BINARY_DIR}/tree-sitter-haskell.pc" @ONLY) include(GNUInstallDirs) install(FILES bindings/c/tree-sitter-haskell.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/tree_sitter") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tree-sitter-haskell.pc" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig") install(TARGETS tree-sitter-haskell LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") add_custom_target(ts-test "${TREE_SITTER_CLI}" test WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMMENT "tree-sitter test") ================================================ FILE: Cargo.toml ================================================ [package] name = "tree-sitter-haskell" description = "Haskell grammar for tree-sitter" version = "0.23.1" authors = ["Max Brunsfeld "] license = "MIT" readme = "README.md" keywords = ["incremental", "parsing", "tree-sitter", "haskell"] categories = ["parsing", "text-editors"] repository = "https://github.com/tree-sitter/tree-sitter-haskell" edition = "2021" autoexamples = false build = "bindings/rust/build.rs" include = ["LICENSE", "bindings/rust/*", "grammar.js", "queries/*", "src/*", "tree-sitter.json"] [lib] path = "bindings/rust/lib.rs" [dependencies] tree-sitter-language = "0.1" [build-dependencies] cc = "1.1.15" [dev-dependencies] tree-sitter = "0.23" ================================================ FILE: LICENSE ================================================ The MIT License (MIT) Copyright (c) 2014 Max Brunsfeld Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: Makefile ================================================ ifeq ($(OS),Windows_NT) $(error Windows is not supported) endif LANGUAGE_NAME := tree-sitter-haskell HOMEPAGE_URL := https://github.com/tree-sitter/tree-sitter-haskell VERSION := 0.23.1 # repository SRC_DIR := src TS ?= tree-sitter # install directory layout PREFIX ?= /usr/local INCLUDEDIR ?= $(PREFIX)/include LIBDIR ?= $(PREFIX)/lib PCLIBDIR ?= $(LIBDIR)/pkgconfig # source/object files PARSER := $(SRC_DIR)/parser.c EXTRAS := $(filter-out $(PARSER),$(wildcard $(SRC_DIR)/*.c)) OBJS := $(patsubst %.c,%.o,$(PARSER) $(EXTRAS)) # flags ARFLAGS ?= rcs override CFLAGS += -I$(SRC_DIR) -std=c11 -fPIC # ABI versioning SONAME_MAJOR = $(shell sed -n 's/\#define LANGUAGE_VERSION //p' $(PARSER)) SONAME_MINOR = $(word 1,$(subst ., ,$(VERSION))) # OS-specific bits ifeq ($(shell uname),Darwin) SOEXT = dylib SOEXTVER_MAJOR = $(SONAME_MAJOR).$(SOEXT) SOEXTVER = $(SONAME_MAJOR).$(SONAME_MINOR).$(SOEXT) LINKSHARED = -dynamiclib -Wl,-install_name,$(LIBDIR)/lib$(LANGUAGE_NAME).$(SOEXTVER),-rpath,@executable_path/../Frameworks else SOEXT = so SOEXTVER_MAJOR = $(SOEXT).$(SONAME_MAJOR) SOEXTVER = $(SOEXT).$(SONAME_MAJOR).$(SONAME_MINOR) LINKSHARED = -shared -Wl,-soname,lib$(LANGUAGE_NAME).$(SOEXTVER) endif ifneq ($(filter $(shell uname),FreeBSD NetBSD DragonFly),) PCLIBDIR := $(PREFIX)/libdata/pkgconfig endif all: lib$(LANGUAGE_NAME).a lib$(LANGUAGE_NAME).$(SOEXT) $(LANGUAGE_NAME).pc lib$(LANGUAGE_NAME).a: $(OBJS) $(AR) $(ARFLAGS) $@ $^ lib$(LANGUAGE_NAME).$(SOEXT): $(OBJS) $(CC) $(LDFLAGS) $(LINKSHARED) $^ $(LDLIBS) -o $@ ifneq ($(STRIP),) $(STRIP) $@ endif $(LANGUAGE_NAME).pc: bindings/c/$(LANGUAGE_NAME).pc.in sed -e 's|@PROJECT_VERSION@|$(VERSION)|' \ -e 's|@CMAKE_INSTALL_LIBDIR@|$(LIBDIR:$(PREFIX)/%=%)|' \ -e 's|@CMAKE_INSTALL_INCLUDEDIR@|$(INCLUDEDIR:$(PREFIX)/%=%)|' \ -e 's|@PROJECT_DESCRIPTION@|$(DESCRIPTION)|' \ -e 's|@PROJECT_HOMEPAGE_URL@|$(HOMEPAGE_URL)|' \ -e 's|@CMAKE_INSTALL_PREFIX@|$(PREFIX)|' $< > $@ $(PARSER): $(SRC_DIR)/grammar.json $(TS) generate $^ install: all install -d '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter '$(DESTDIR)$(PCLIBDIR)' '$(DESTDIR)$(LIBDIR)' install -m644 bindings/c/$(LANGUAGE_NAME).h '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/$(LANGUAGE_NAME).h install -m644 $(LANGUAGE_NAME).pc '$(DESTDIR)$(PCLIBDIR)'/$(LANGUAGE_NAME).pc install -m644 lib$(LANGUAGE_NAME).a '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).a install -m755 lib$(LANGUAGE_NAME).$(SOEXT) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER) ln -sf lib$(LANGUAGE_NAME).$(SOEXTVER) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) ln -sf lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXT) uninstall: $(RM) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).a \ '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER) \ '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) \ '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXT) \ '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/$(LANGUAGE_NAME).h \ '$(DESTDIR)$(PCLIBDIR)'/$(LANGUAGE_NAME).pc clean: $(RM) $(OBJS) $(LANGUAGE_NAME).pc lib$(LANGUAGE_NAME).a lib$(LANGUAGE_NAME).$(SOEXT) test: $(TS) test .PHONY: all install uninstall clean test ================================================ FILE: Package.resolved ================================================ { "object": { "pins": [ { "package": "SwiftTreeSitter", "repositoryURL": "https://github.com/ChimeHQ/SwiftTreeSitter", "state": { "branch": null, "revision": "2599e95310b3159641469d8a21baf2d3d200e61f", "version": "0.8.0" } } ] }, "version": 1 } ================================================ FILE: Package.swift ================================================ // swift-tools-version:5.3 import PackageDescription let package = Package( name: "TreeSitterHaskell", products: [ .library(name: "TreeSitterHaskell", targets: ["TreeSitterHaskell"]), ], dependencies: [ .package(url: "https://github.com/ChimeHQ/SwiftTreeSitter", from: "0.8.0"), ], targets: [ .target( name: "TreeSitterHaskell", dependencies: [], path: ".", sources: [ "src/parser.c", "src/scanner.c", ], resources: [ .copy("queries") ], publicHeadersPath: "bindings/swift", cSettings: [.headerSearchPath("src")] ), .testTarget( name: "TreeSitterHaskellTests", dependencies: [ "SwiftTreeSitter", "TreeSitterHaskell", ], path: "bindings/swift/TreeSitterHaskellTests" ) ], cLanguageStandard: .c11 ) ================================================ FILE: README.md ================================================ # tree-sitter-haskell [![CI][ci]](https://github.com/tree-sitter/tree-sitter-haskell/actions/workflows/ci.yml) [![discord][discord]](https://discord.gg/w7nTvsVJhm) [![matrix][matrix]](https://matrix.to/#/#tree-sitter-chat:matrix.org) [![crates][crates]](https://crates.io/crates/tree-sitter-haskell) [![npm][npm]](https://www.npmjs.com/package/tree-sitter-haskell) [![pypi][pypi]](https://pypi.org/project/tree-sitter-haskell) Haskell grammar for [tree-sitter]. # References - [Haskell 2010 Language Report – Syntax References][ref] - [GHC Language Extensions][ext] # Supported Language Extensions These extensions are supported ✅, unsupported ❌ or not applicable because they don't involve parsing ➖️: - AllowAmbiguousTypes ➖️ - ApplicativeDo ➖️ - Arrows ❌ - BangPatterns ✅ - BinaryLiterals ✅ - BlockArguments ✅ - CApiFFI ✅ - ConstrainedClassMethods ✅ - ConstraintKinds ✅ - CPP ✅ - CUSKs ✅ - DataKinds ✅ - DatatypeContexts ✅ - DefaultSignatures ✅ - DeriveAnyClass ➖️ - DeriveDataTypeable ➖️ - DeriveFoldable ➖️ - DeriveFunctor ➖️ - DeriveGeneric ➖️ - DeriveLift ➖️ - DeriveTraversable ➖️ - DerivingStrategies ✅ - DerivingVia ✅ - DisambiguateRecordFields ➖️ - DuplicateRecordFields ➖️ - EmptyCase ✅ - EmptyDataDecls ✅ - EmptyDataDeriving ✅ - ExistentialQuantification ✅ - ExplicitForAll ✅ - ExplicitNamespaces ✅ - ExtendedDefaultRules ➖️ - FlexibleContexts ✅ - FlexibleInstances ✅ - ForeignFunctionInterface ✅ - FunctionalDependencies ✅ - GADTs ✅ - GADTSyntax ✅ - GeneralisedNewtypeDeriving ➖️ - GHCForeignImportPrim ✅ - Haskell2010 ➖️ - Haskell98 ➖️ - HexFloatLiterals ✅ - ImplicitParams ✅ - ImplicitPrelude ➖️ - ImportQualifiedPost ✅ - ImpredicativeTypes ➖️ - IncoherentInstances ➖️ - InstanceSigs ✅ - InterruptibleFFI ✅ - KindSignatures ✅ - LambdaCase ✅ - LexicalNegation ❌ - LiberalTypeSynonyms ✅ - LinearTypes ✅ - ListTuplePuns ✅ - MagicHash ✅ - Modifiers ❌ - MonadComprehensions ➖️ - MonadFailDesugaring ➖️ - MonoLocalBinds ➖️ - MonomorphismRestriction ➖️ - MultiParamTypeClasses ✅ - MultiWayIf ✅ - NamedFieldPuns ✅ - NamedWildCards ✅ - NegativeLiterals ➖️ - NondecreasingIndentation ✅ - NPlusKPatterns ➖️ - NullaryTypeClasses ✅ - NumDecimals ➖️ - NumericUnderscores ✅ - OverlappingInstances ➖️ - OverloadedLabels ✅ - OverloadedLists ➖️ - OverloadedRecordDot ✅ - OverloadedRecordUpdate ✅ - OverloadedStrings ➖️ - PackageImports ✅ - ParallelListComp ✅ - PartialTypeSignatures ✅ - PatternGuards ✅ - PatternSynonyms ✅ - PolyKinds ➖️ - PostfixOperators ➖️ - QualifiedDo ✅ - QuantifiedConstraints ✅ - QuasiQuotes ✅ - Rank2Types ✅ - RankNTypes ✅ - RebindableSyntax ➖️ - RecordWildCards ➖️ - RecursiveDo ✅ - RequiredTypeArguments ✅ - RoleAnnotations ✅ - Safe ➖️ - ScopedTypeVariables ✅ - StandaloneDeriving ✅ - StandaloneKindSignatures ✅ - StarIsType ✅ - StaticPointers ❌ - Strict ➖️ - StrictData ✅ - TemplateHaskell ✅ - TemplateHaskellQuotes ✅ - TraditionalRecordSyntax ➖️ - TransformListComp ✅ - Trustworthy ➖️ - TupleSections ✅ - TypeAbstractions ✅ - TypeApplications ✅ - TypeData ✅ - TypeFamilies ✅ - TypeFamilyDependencies ✅ - TypeInType ✅ - TypeOperators ✅ - TypeSynonymInstances ➖️ - UnboxedSums ✅ - UnboxedTuples ✅ - UndecidableInstances ➖️ - UndecidableSuperClasses ➖️ - UnicodeSyntax ✅ - UnliftedFFITypes ➖️ - UnliftedNewtypes ✅ - Unsafe ➖️ - ViewPatterns ✅ # Bugs ## CPP Preprocessor `#elif` and `#else` directives cannot be handled correctly, since the parser state would have to be manually reset to what it was at the `#if`. As a workaround, the code blocks in the alternative branches are parsed as part of the directives. # Querying The grammar contains several [supertypes](https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types), which group multiple other node types under a single name. Supertype names do not occur as extra nodes in parse trees, but they can be used in queries in special ways: - As an alias, matching any of their subtypes - As prefix for one of their subtypes, matching its symbol only when it occurs as a production of the supertype For example, the query `(expression)` matches the nodes `infix`, `record`, `projection`, `constructor`, and the second and third `variable` in this tree for `cats <> Cat {mood = moods.sleepy}`: ``` (infix (variable) (operator) (record (constructor) (field_update (field_name (variable)) (projection (variable) (field_name (variable))))))))) ``` The two occurrences of `variable` in `field_name` (`mood` and `sleepy`) are not expressions, but record field names part of a composite `record` expression. Matching `variable` nodes specifically that are expressions is possible with the second special form. A query for `(expression/variable)` will match only the other two, `cats` and `moods`. The grammar's supertypes consist of the following sets: - [`expression`](./grammar/exp.js) Rules that are valid in any expression position, excluding type applications, explicit types and expression signatures. - [`pattern`](./grammar/pat.js) Rules that are valid in any pattern position, excluding type binders, explicit types and pattern signatures. - [`type`](./grammar/type.js) Types that are either atomic (have no ambiguous associativity, like bracketed constructs, variables and type constructors), applied types or infix types. - [`quantified_type`](./grammar/type.js) Types prefixed with a `forall`, context or function parameter. - [`constraint`](./grammar/constraint.js) Almost the same rules as `type`, but mirrored for use in contexts. - [`constraints`](./grammar/constraints.js) Analog of `quantified_type`, for constraints with `forall` or context. - [`type_param`](./grammar/type.js) Atomic nodes in type and class heads, like the three nodes following `A` in `data A @k a (b :: k)`. - [`declaration`](./grammar/module.js) All top-level declarations, like functions and data types. - [`decl`](./grammar/decl.js) Shorthand for declarations that are also valid in local bindings (`let` and `where`) and in class and instance bodies, except for fixity declarations. Consists of `signature`, `function` and `bind`. - [`class_decl` and `instance_decl`](./grammar/class.js) All declarations that are valid in classes and instances, which includes associated type and data families. - [`statement`](./grammar/exp.js) Different forms of `do`-notation statements. - [`qualifier`](./grammar/exp.js) Different forms of list comprehension qualifiers. - [`guard`](./grammar/exp.js) Different forms of guards in function equations and case alternatives. # Development The main driver for generating and testing the parser for this grammar is the [tree-sitter CLI][cli]. Other components of the project require additional tools, described below. Some are made available through `npm` – for example, `npx tree-sitter` runs the CLI. If you don't have `tree-sitter` available otherwise, prefix all the commands in the following sections with `npx`. ## Output path The CLI writes the shared library containing the parser to the directory denoted by `$TREE_SITTER_LIBDIR`. If that variable is unset, it defaults to `$HOME/.cache/tree-sitter/lib`. In order to avoid clobbering this global directory with development versions, you can set the env var to a local path: ``` export TREE_SITTER_LIBDIR=$PWD/.lib ``` ## The grammar The javascript file `grammar.js` contains the entry point into the grammar's production rules. Please consult the [tree-sitter documentation][grammar-docs] for a comprehensive introduction to the syntax and semantics. Parsing starts with the first item in the `rules` field: ```javascript { rules: { haskell: $ => seq( optional($.header), optional($._body), ), } } ``` ## Generating the parser The first step in the development workflow converts the javascript rule definitions to C code in `src/parser.c`: ``` $ tree-sitter generate ``` Two byproducts of this process are written to `src/grammar.json` and `src/node-types.json`. ## Compiling the parser The C code is automatically compiled by most of the test tools mentioned below, but you can instruct tree-sitter to do it in one go: ``` $ tree-sitter generate --build ``` If you've set `$TREE_SITTER_LIBDIR` as mentioned above, the shared object will be written to `$PWD/.lib/haskell.so`. Aside from the generated `src/parser.c`, tree-sitter will also compile and link `src/scanner.c` into this object. This file contains the _external scanner_, which is a custom extension of the built-in lexer whose purpose is to handle language constructs that cannot be expressed (efficiently) in the javascript grammar, like Haskell layouts. ### WebAssembly The parser can be compiled to WebAssembly as well, which requires `emscripten`: ``` $ tree-sitter build --wasm ``` The resulting binary is written to `$PWD/tree-sitter-haskell.wasm`. ## Testing the parser The most fundamental test infrastructure for tree-sitter grammars consists of a set of code snippets with associated reference ASTs stored in `./test/corpus/*.txt`. ``` $ tree-sitter test ``` Individual tests can be run by specifying (a substring of) their description with `-f`: ``` $ tree-sitter test -f 'module: exports empty' ``` The project contains several other types of tests: - `test/parse/run.bash [update] [test names ...]` parses the files in `test/parse/*.hs` and compares the output with `test/parse/*.target`. If `update` is specified as the first argument, it will update the `.target` file for the first failing test. - `test/query/run.bash [update] [test names ...]` parses the files in `test/query/*.hs`, applies the queries in `test/query/*.query` and compares the output with `test/query/*.target`, similar to `test/parse`. - `test/rust/parse-test.rs` contains a few tests that use tree-sitter's Rust API to extract the test ranges for terminals in a slightly more convenient way. This requires `cargo` to be installed, and can be executed with `cargo test` (which also runs the tests in `bindings/rust`). - `test/parse-libs [wasm]` clones a set of Haskell libraries to `test/libs` and parses the entire codebase. When invoked as `test/parse-libs wasm`, it will use the WebAssembly parser. This requires `bc` to be installed. - `test/parse-lib name [wasm]` parses only the library `name` in that directory (without cloning the repository). ### Debugging The shared library built by `tree-sitter test` includes debug symbols, so if the scanner segfaults you can just run `coredumpctl debug` to inspect the backtrace and memory: ``` newline_lookahead () at src/scanner.c:2583 2583 ((Newline *) 0)->indent = 5; (gdb) bt #0 newline_lookahead () at src/scanner.c:2583 #1 0x00007ffff7a0740e in newline_start () at src/scanner.c:2604 #2 scan () at src/scanner.c:2646 #3 eval () at src/scanner.c:2684 #4 tree_sitter_haskell_external_scanner_scan (payload=, lexer=, valid_symbols=) at src/scanner.c:2724 #5 0x0000555555772488 in ts_parser.lex () ``` For more control, launch `gdb tree-sitter` and start the process with `run test -f 'some test'`, and set a breakpoint with `break tree_sitter_haskell_external_scanner_scan`. To disable optimizations, run `tree-sitter test --debug-build`. #### Tracing The `test` and `parse` commands offer two modes for obtaining detailed information about the parsing process. With `tree-sitter test --debug`, every lexer step and shift/reduce action is printed to stderr. With `tree-sitter test --debug-graph`, the CLI will generate an HTML file showing a graph representation of every step. This requires `graphviz` to be installed. [tree-sitter]: https://github.com/tree-sitter/tree-sitter [ref]: https://www.haskell.org/onlinereport/haskell2010/haskellch10.html [ext]: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/exts/table.html [cli]: https://github.com/tree-sitter/tree-sitter/tree/master/cli [grammar-docs]: https://tree-sitter.github.io/tree-sitter/creating-parsers#writing-the-grammar [ci]: https://img.shields.io/github/actions/workflow/status/tree-sitter/tree-sitter-haskell/ci.yml?logo=github&label=CI [discord]: https://img.shields.io/discord/1063097320771698699?logo=discord&label=discord [matrix]: https://img.shields.io/matrix/tree-sitter-chat%3Amatrix.org?logo=matrix&label=matrix [npm]: https://img.shields.io/npm/v/tree-sitter-haskell?logo=npm [crates]: https://img.shields.io/crates/v/tree-sitter-haskell?logo=rust [pypi]: https://img.shields.io/pypi/v/tree-sitter-haskell?logo=pypi&logoColor=ffd242 ================================================ FILE: binding.gyp ================================================ { "targets": [ { "target_name": "tree_sitter_haskell_binding", "dependencies": [ " typedef struct TSLanguage TSLanguage; extern "C" TSLanguage *tree_sitter_haskell(); // "tree-sitter", "language" hashed with BLAKE2 const napi_type_tag LANGUAGE_TYPE_TAG = { 0x8AF2E5212AD58ABF, 0xD5006CAD83ABBA16 }; Napi::Object Init(Napi::Env env, Napi::Object exports) { exports["name"] = Napi::String::New(env, "haskell"); auto language = Napi::External::New(env, tree_sitter_haskell()); language.TypeTag(&LANGUAGE_TYPE_TAG); exports["language"] = language; return exports; } NODE_API_MODULE(tree_sitter_haskell_binding, Init) ================================================ FILE: bindings/node/binding_test.js ================================================ const assert = require("node:assert"); const { test } = require("node:test"); const Parser = require("tree-sitter"); test("can load grammar", () => { const parser = new Parser(); assert.doesNotThrow(() => parser.setLanguage(require("."))); }); ================================================ FILE: bindings/node/index.d.ts ================================================ type BaseNode = { type: string; named: boolean; }; type ChildNode = { multiple: boolean; required: boolean; types: BaseNode[]; }; type NodeInfo = | (BaseNode & { subtypes: BaseNode[]; }) | (BaseNode & { fields: { [name: string]: ChildNode }; children: ChildNode[]; }); type Language = { name: string; language: unknown; nodeTypeInfo: NodeInfo[]; }; declare const language: Language; export = language; ================================================ FILE: bindings/node/index.js ================================================ const root = require("path").join(__dirname, "..", ".."); module.exports = typeof process.versions.bun === "string" // Support `bun build --compile` by being statically analyzable enough to find the .node file at build-time ? require(`../../prebuilds/${process.platform}-${process.arch}/tree-sitter-haskell.node`) : require("node-gyp-build")(root); try { module.exports.nodeTypeInfo = require("../../src/node-types.json"); } catch (_) {} ================================================ FILE: bindings/python/tests/test_binding.py ================================================ from unittest import TestCase import tree_sitter, tree_sitter_haskell class TestLanguage(TestCase): def test_can_load_grammar(self): try: tree_sitter.Language(tree_sitter_haskell.language()) except Exception: self.fail("Error loading Haskell grammar") ================================================ FILE: bindings/python/tree_sitter_haskell/__init__.py ================================================ """Haskell grammar for tree-sitter""" from importlib.resources import files as _files from ._binding import language def _get_query(name, file): query = _files(f"{__package__}.queries") / file globals()[name] = query.read_text() return globals()[name] def __getattr__(name): if name == "HIGHLIGHTS_QUERY": return _get_query("HIGHLIGHTS_QUERY", "highlights.scm") if name == "INJECTIONS_QUERY": return _get_query("INJECTIONS_QUERY", "injections.scm") if name == "LOCALS_QUERY": return _get_query("LOCALS_QUERY", "locals.scm") raise AttributeError(f"module {__name__!r} has no attribute {name!r}") __all__ = [ "language", "HIGHLIGHTS_QUERY", "INJECTIONS_QUERY", "LOCALS_QUERY", ] def __dir__(): return sorted(__all__ + [ "__all__", "__builtins__", "__cached__", "__doc__", "__file__", "__loader__", "__name__", "__package__", "__path__", "__spec__", ]) ================================================ FILE: bindings/python/tree_sitter_haskell/__init__.pyi ================================================ from typing import Final HIGHLIGHTS_QUERY: Final[str] INJECTIONS_QUERY: Final[str] LOCALS_QUERY: Final[str] def language() -> object: ... ================================================ FILE: bindings/python/tree_sitter_haskell/binding.c ================================================ #include typedef struct TSLanguage TSLanguage; TSLanguage *tree_sitter_haskell(void); static PyObject* _binding_language(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(args)) { return PyCapsule_New(tree_sitter_haskell(), "tree_sitter.Language", NULL); } static PyMethodDef methods[] = { {"language", _binding_language, METH_NOARGS, "Get the tree-sitter language for this grammar."}, {NULL, NULL, 0, NULL} }; static struct PyModuleDef module = { .m_base = PyModuleDef_HEAD_INIT, .m_name = "_binding", .m_doc = NULL, .m_size = -1, .m_methods = methods }; PyMODINIT_FUNC PyInit__binding(void) { return PyModule_Create(&module); } ================================================ FILE: bindings/python/tree_sitter_haskell/py.typed ================================================ ================================================ FILE: bindings/rust/build.rs ================================================ fn main() { let src_dir = std::path::Path::new("src"); let mut c_config = cc::Build::new(); c_config .std("c11") .include(src_dir) .flag_if_supported("-Wno-unused-value"); #[cfg(target_env = "msvc")] c_config.flag("-utf-8"); let parser_path = src_dir.join("parser.c"); c_config.file(&parser_path); println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap()); let scanner_path = src_dir.join("scanner.c"); c_config.file(&scanner_path); println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap()); c_config.compile("tree-sitter-haskell"); } ================================================ FILE: bindings/rust/lib.rs ================================================ //! This crate provides Haskell language support for the [tree-sitter][] parsing library. //! //! Typically, you will use the [language][language func] function to add this language to a //! tree-sitter [Parser][], and then use the parser to parse some code: //! //! ``` //! use tree_sitter::Parser; //! //! let code = r#" //! main = putStrLn "Hello World!" //! "#; //! let mut parser = Parser::new(); //! let language = tree_sitter_haskell::LANGUAGE; //! parser //! .set_language(&language.into()) //! .expect("Error loading Haskell parser"); //! let tree = parser.parse(code, None).unwrap(); //! assert!(!tree.root_node().has_error()); //! ``` //! //! [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html //! [language func]: fn.language.html //! [Parser]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html //! [tree-sitter]: https://tree-sitter.github.io/ use tree_sitter_language::LanguageFn; extern "C" { fn tree_sitter_haskell() -> *const (); } /// The tree-sitter [`LanguageFn`] for this grammar. pub const LANGUAGE: LanguageFn = unsafe { LanguageFn::from_raw(tree_sitter_haskell) }; /// The content of the [`node-types.json`][] file for this grammar. /// /// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types pub const NODE_TYPES: &str = include_str!("../../src/node-types.json"); /// The syntax highlighting query for this language. pub const HIGHLIGHTS_QUERY: &str = include_str!("../../queries/highlights.scm"); /// The syntax highlighting query for languages injected into this one. pub const INJECTIONS_QUERY: &str = include_str!("../../queries/injections.scm"); /// The local-variable syntax highlighting query for this language. pub const LOCALS_QUERY: &str = include_str!("../../queries/locals.scm"); #[cfg(test)] mod tests { #[test] fn test_can_load_grammar() { let mut parser = tree_sitter::Parser::new(); parser .set_language(&super::LANGUAGE.into()) .expect("Error loading Haskell parser"); } } ================================================ FILE: bindings/swift/TreeSitterHaskell/haskell.h ================================================ #ifndef TREE_SITTER_HASKELL_H_ #define TREE_SITTER_HASKELL_H_ typedef struct TSLanguage TSLanguage; #ifdef __cplusplus extern "C" { #endif const TSLanguage *tree_sitter_haskell(void); #ifdef __cplusplus } #endif #endif // TREE_SITTER_HASKELL_H_ ================================================ FILE: bindings/swift/TreeSitterHaskellTests/TreeSitterHaskellTests.swift ================================================ import XCTest import SwiftTreeSitter import TreeSitterHaskell final class TreeSitterHaskellTests: XCTestCase { func testCanLoadGrammar() throws { let parser = Parser() let language = Language(language: tree_sitter_haskell()) XCTAssertNoThrow(try parser.setLanguage(language), "Error loading Haskell grammar") } } ================================================ FILE: examples/Basic.hs ================================================ a = 1 b = 2 c = 3 ================================================ FILE: go.mod ================================================ module github.com/tree-sitter/tree-sitter-haskell go 1.22 require github.com/tree-sitter/go-tree-sitter v0.24.0 require github.com/mattn/go-pointer v0.0.1 // indirect ================================================ FILE: go.sum ================================================ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/mattn/go-pointer v0.0.1 h1:n+XhsuGeVO6MEAp7xyEukFINEa+Quek5psIR/ylA6o0= github.com/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tree-sitter/go-tree-sitter v0.24.0 h1:kRZb6aBNfcI/u0Qh8XEt3zjNVnmxTisDBN+kXK0xRYQ= github.com/tree-sitter/go-tree-sitter v0.24.0/go.mod h1:x681iFVoLMEwOSIHA1chaLkXlroXEN7WY+VHGFaoDbk= github.com/tree-sitter/tree-sitter-c v0.21.5-0.20240818205408-927da1f210eb h1:A8425heRM8mylnv4H58FPUiH+aYivyitre0PzxrfmWs= github.com/tree-sitter/tree-sitter-c v0.21.5-0.20240818205408-927da1f210eb/go.mod h1:dOF6gtQiF9UwNh995T5OphYmtIypkjsp3ap7r9AN/iA= github.com/tree-sitter/tree-sitter-cpp v0.22.4-0.20240818224355-b1a4e2b25148 h1:AfFPZwtwGN01BW1jDdqBVqscTwetvMpydqYZz57RSlc= github.com/tree-sitter/tree-sitter-cpp v0.22.4-0.20240818224355-b1a4e2b25148/go.mod h1:Bh6U3viD57rFXRYIQ+kmiYtr+1Bx0AceypDLJJSyi9s= github.com/tree-sitter/tree-sitter-embedded-template v0.21.1-0.20240819044651-ffbf64942c33 h1:TwqSV3qLp3tKSqirGLRHnjFk9Tc2oy57LIl+FQ4GjI4= github.com/tree-sitter/tree-sitter-embedded-template v0.21.1-0.20240819044651-ffbf64942c33/go.mod h1:CvCKCt3v04Ufos1zZnNCelBDeCGRpPucaN8QczoUsN4= github.com/tree-sitter/tree-sitter-go v0.21.3-0.20240818010209-8c0f0e7a6012 h1:Xvxck3tE5FW7F7bTS97iNM2ADMyCMJztVqn5HYKdJGo= github.com/tree-sitter/tree-sitter-go v0.21.3-0.20240818010209-8c0f0e7a6012/go.mod h1:T40D0O1cPvUU/+AmiXVXy1cncYQT6wem4Z0g4SfAYvY= github.com/tree-sitter/tree-sitter-html v0.20.5-0.20240818004741-d11201a263d0 h1:c46K6uh5Dz00zJeU9BfjXdb8I+E4RkUdfnWJpQADXFo= github.com/tree-sitter/tree-sitter-html v0.20.5-0.20240818004741-d11201a263d0/go.mod h1:hcNt/kOJHcIcuMvouE7LJcYdeFUFbVpBJ6d4wmOA+tU= github.com/tree-sitter/tree-sitter-java v0.21.1-0.20240824015150-576d8097e495 h1:jrt4qbJVEFs4H93/ITxygHc6u0TGqAkkate7TQ4wFSA= github.com/tree-sitter/tree-sitter-java v0.21.1-0.20240824015150-576d8097e495/go.mod h1:oyaR7fLnRV0hT9z6qwE9GkaeTom/hTDwK3H2idcOJFc= github.com/tree-sitter/tree-sitter-javascript v0.21.5-0.20240818005344-15887341e5b5 h1:om4X9AVg3asL8gxNJDcz4e/Wp+VpQj1PY3uJXKr6EOg= github.com/tree-sitter/tree-sitter-javascript v0.21.5-0.20240818005344-15887341e5b5/go.mod h1:nNqgPoV/h9uYWk6kYEFdEAhNVOacpfpRW5SFmdaP4tU= github.com/tree-sitter/tree-sitter-json v0.21.1-0.20240818005659-bdd69eb8c8a5 h1:pfV3G3k7NCKqKk8THBmyuh2zA33lgYHS3GVrzRR8ry4= github.com/tree-sitter/tree-sitter-json v0.21.1-0.20240818005659-bdd69eb8c8a5/go.mod h1:GbMKRjLfk0H+PI7nLi1Sx5lHf5wCpLz9al8tQYSxpEk= github.com/tree-sitter/tree-sitter-php v0.22.9-0.20240819002312-a552625b56c1 h1:ZXZMDwE+IhUtGug4Brv6NjJWUU3rfkZBKpemf6RY8/g= github.com/tree-sitter/tree-sitter-php v0.22.9-0.20240819002312-a552625b56c1/go.mod h1:UKCLuYnJ312Mei+3cyTmGOHzn0YAnaPRECgJmHtzrqs= github.com/tree-sitter/tree-sitter-python v0.21.1-0.20240818005537-55a9b8a4fbfb h1:EXEM82lFM7JjJb6qiKZXkpIDaCcbV2obNn82ghwj9lw= github.com/tree-sitter/tree-sitter-python v0.21.1-0.20240818005537-55a9b8a4fbfb/go.mod h1:lXCF1nGG5Dr4J3BTS0ObN4xJCCICiSu/b+Xe/VqMV7g= github.com/tree-sitter/tree-sitter-ruby v0.21.1-0.20240818211811-7dbc1e2d0e2d h1:fcYCvoXdcP1uRQYXqJHRy6Hec+uKScQdKVtMwK9JeCI= github.com/tree-sitter/tree-sitter-ruby v0.21.1-0.20240818211811-7dbc1e2d0e2d/go.mod h1:T1nShQ4v5AJtozZ8YyAS4uzUtDAJj/iv4YfwXSbUHzg= github.com/tree-sitter/tree-sitter-rust v0.21.3-0.20240818005432-2b43eafe6447 h1:o9alBu1J/WjrcTKEthYtXmdkDc5OVXD+PqlvnEZ0Lzc= github.com/tree-sitter/tree-sitter-rust v0.21.3-0.20240818005432-2b43eafe6447/go.mod h1:1Oh95COkkTn6Ezp0vcMbvfhRP5gLeqqljR0BYnBzWvc= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= ================================================ FILE: grammar/class.js ================================================ const { sep1, layout, context, forall, } = require('./util.js') module.exports = { // ------------------------------------------------------------------------ // associated families // ------------------------------------------------------------------------ /** * In associated family declarations, result type aliasing without injectivity is invalid, since that syntax is taken * by type instance declarations. */ _assoc_tyfam: $ => seq( 'type', optional('family'), $._type_head, optional(choice( $._kind_annotation, seq( $.type_family_result, $.type_family_injectivity, ), )), ), _assoc_tyinst: $ => seq( 'type', optional('instance'), forall($), $._cond_assoc_tyinst, $._type_instance_common, ), _assoc_datafam: $ => seq( 'data', optional('family'), $._datafam, ), _assoc_datainst_adt: $ => seq( 'data', optional('instance'), $._inst_adt, ), _assoc_datainst_newtype: $ => seq( 'newtype', optional('instance'), $._inst_newtype, ), _assoc_datainst: $ => choice( alias($._assoc_datainst_adt, $.data_type), alias($._assoc_datainst_newtype, $.newtype), ), // ------------------------------------------------------------------------ // class // ------------------------------------------------------------------------ default_signature: $ => seq('default', field('signature', $.signature)), /** * Classes can have both type families and instances, but only data families. */ class_decl: $ => choice( $._local_decl, $.default_signature, alias($._assoc_tyfam, $.type_family), alias($._assoc_tyinst, $.type_instance), alias($._assoc_datafam, $.data_family), ), fundep: $ => seq( field('matched', repeat1($.variable)), $._arrow, field('determined', repeat1($.variable)), ), fundeps: $ => seq($._bar, sep1(',', field('fundep', $.fundep))), class_declarations: $ => layout($, field('declaration', $.class_decl)), class: $ => seq( 'class', context($), $._type_head, field('fundeps', optional($.fundeps)), optional(seq($._where, optional(field('declarations', $.class_declarations)))), ), // ------------------------------------------------------------------------ // instance // ------------------------------------------------------------------------ instance_decl: $ => choice( $.decl, alias($._assoc_datainst, $.data_instance), alias($._assoc_tyinst, $.type_instance), ), instance_declarations: $ => layout($, field('declaration', $.instance_decl)), /** * instances only allow single foralls and contexts */ _instance: $ => seq( 'instance', forall($), context($), $._type_instance_head, ), instance: $ => seq( $._instance, optional(seq($._where, optional(field('declarations', $.instance_declarations)))), ), deriving_instance: $ => seq( optional($._phantom_deriving), 'deriving', optional(choice(field('strategy', $.deriving_strategy), field('via', $.via))), $._instance, ), } ================================================ FILE: grammar/conflicts.js ================================================ module.exports = { conflicts: $ => [ /** * For reference in GHC: * - Note [Ambiguous syntactic categories] * - Note [PatBuilder] * - Note [Declaration/signature overlap] * - These correspond to `DisambECP` * * (fun x) y = undefined * (fun x -> y) = undefined * (fun) <> x = undefined * * The first one is a regular function with some redundant parens, where `fun` is the declared name. * The second one is a pattern binder with a view pattern, where `fun` is a free variable. * The third one is an infix pattern binder, where `fun` is a simple varid pattern with redundant parens. * * These conflicts are also relevant for top-level expression splices, which fundamentally conflict with decls, and * since decls start with either `var` or `pat`, they cannot be disambiguated. * * GHC parses functions and binds as expressions and sorts them into the right LHS in a post-processing step. * Since this is not possible in tree-sitter, these conflicts are more function-centric than in GHC. * * function: * func (A a) = a * * bind variable: * a : as = [1, 2, 3] * * pattern bind infix: * a : as = [1, 2, 3] * * pattern bind prefix: * Just 1 = Just 1 * * splice: * makeLenses ''A * * Signature and bind: * * fun :: Int * fun :: Int = 5 */ // Function vs bind [$._function_name, $.pattern], // Function vs bind vs splice [$._function_name, $.pattern, $.expression], // Bind vs splice [$.pattern, $.expression], // Signature vs bind [$.signature, $.pattern], /** * Unboxed syntax * * The hash in the opening parenthesis of unboxed tuples can be an operator. */ [$._operator_hash_head, $._unboxed_open], /** * Types conflicting with structures that look like types * * Note: These conflicts have been circumvented by a lookahead mechanism in the scanner. * This comment is preserved for reference. * * `name` and `constructor` use the same terminal symbol, but we cannot reduce `constructor` in prefix data * constructor declarations. * * In GHC, this corresponds to `DisambTD`. * * > data A = Name Int * > data A = Maybe Int :+ Int * > data A = Monoid a => A a * * All of these start with a `name` node. * In the first example, the `name` is a data constructor, which will not be reduced to a `type`. * * In the second example, the `name` is a type constructor applied to another type in the left operand of an infix * data constructor, so it must be reduced to `type`, and then to `apply` with the `Int`. * * In the third example, the `name` is a type constructor applied to a variable resulting in a constraint. * It will be reduced the same way as the second example, but using the class tree, which is mostly identical to the * type tree, but conflicts since we want to distinguish classes from types granularly. * * In GHC, these correspond to `mkHsAppTyHeadPV` and `mkHsAppTyPV`. * * > data A a b = a `C` b => a `A` b * > data A a b = a `A` b * * > data a *** b * > data a +++ b => a *** b * * In GHC, this corresponds to `mkHsOpTyPV`. * * > class A where type a + b = r | r -> a b * > class A where type a + b = (a, b) * * The first one is a type family declaration, the second one an instance. * * These were the conflicts that have been turned into scanner lookahead: * * [$._type_con, $.data_constructor], * [$._type_con, $._type_head_name], * [$._type_variable, $._tyvar], * [$._constructor_ticked, $._tycon_ticked], */ ], } ================================================ FILE: grammar/context.js ================================================ const { parens, sep2, } = require('./util.js') module.exports = { // ------------------------------------------------------------------------ // context // ------------------------------------------------------------------------ _class_apply: $ => prec.left('apply', seq( field('constructor', $.constraint), field('argument', $._type_apply_arg), )), _class_infix: $ => prec.right('infix', seq( $._cond_infix, field('left_operand', $.type), field('operator', $._tyops), field('right_operand', $.type), )), _ctr_parens: $ => parens($, $.constraints), _ctr_tuple: $ => parens($, sep2(',', $.constraints)), /** * Implicit parameters have an annotation with `::` but bind tighter than `_type_signature`, with the same precedence * as foralls, contexts and arrows. * * > A => ?a :: A | associates as | A => (?a :: A) * > ?a :: A -> A | associates as | ?a :: (A -> A) */ implicit_parameter: $ => prec.left(seq(field('name', $.implicit_variable), $._type_annotation)), constraint: $ => choice( $._type_name, alias($._class_infix, $.infix), alias($._class_apply, $.apply), alias($._ctr_parens, $.parens), alias($._ctr_tuple, $.tuple), alias($._type_wildcard, $.wildcard), $._universal, ), _ctr_forall: $ => prec('fun', seq($._forall_body, '.', field('constraint', $.constraints))), _ctr_context: $ => prec('fun', seq($._context_inline, field('constraint', $.constraints))), _ctr_signature: $ => prec('annotated', seq(field('constraint', $.constraints), $._kind_annotation)), constraints: $ => choice( $.constraint, alias($._ctr_context, $.context), alias($._ctr_forall, $.forall), $.implicit_parameter, alias($._ctr_signature, $.signature), ), _context_inline: $ => seq( $._cond_context, field('context', $.constraint), field('arrow', $._carrow), ), context: $ => prec('qtype-single', $._context_inline), } ================================================ FILE: grammar/data.js ================================================ const { sep1, sep, braces, layout, unboxed_sum_single, qualified, context, forall, } = require('./util.js') module.exports = { // ------------------------------------------------------------------------ // fields // ------------------------------------------------------------------------ field_name: $ => $.variable, _qfield_name: $ => qualified($, $.field_name), _field_names: $ => choice($.field_name, alias($._qfield_name, $.qualified)), field_path: $ => seq( field('field', $._field_names), repeat1(seq($._tight_dot, field('subfield', $.field_name))), ), _field_spec: $ => choice( $._field_names, $.field_path, ), field: $ => prec('annotated', seq( sep1(',', field('name', $.field_name)), $._colon2, field('type', $._parameter_type), )), _record_fields: $ => braces($, sep(',', field('field', $.field)), optional(',')), // ------------------------------------------------------------------------ // deriving // ------------------------------------------------------------------------ via: $ => seq('via', field('type', $.quantified_type)), deriving_strategy: _ => choice('stock', 'newtype', 'anyclass'), deriving: $ => seq( optional($._phantom_deriving), 'deriving', optional(field('strategy', $.deriving_strategy)), field('classes', $.constraint), optional(field('via', $.via)), ), // ------------------------------------------------------------------------ // gadt // ------------------------------------------------------------------------ _gadt_con_prefix: $ => field('type', $.quantified_type), _gadt_con_record: $ => seq( field('fields', alias($._record_fields, $.fields)), field('arrow', $._fun_arrow), field('type', $.quantified_type), ), /** * GADT constructors only allow single foralls and contexts */ gadt_constructor: $ => seq( choice( field('name', $._con), field('names', alias($._con_binding_list, $.binding_list)), ), $._colon2, forall($), context($), field('type', choice( alias($._gadt_con_prefix, $.prefix), alias($._gadt_con_record, $.record), )), ), gadt_constructors: $ => layout($, field('constructor', $.gadt_constructor)), _gadt: $ => seq( optional($._kind_annotation), $._where, optional(field('constructors', $.gadt_constructors)), ), // ------------------------------------------------------------------------ // data type // ------------------------------------------------------------------------ _field_type: $ => choice($.strict_field, $.lazy_field, $.type), _datacon_prefix: $ => seq( field('name', $._con), repeat(prec('patterns', field('field', $._field_type))), ), _datacon_infix: $ => prec('infix', seq( $._cond_data_infix, field('left_operand', $._field_type), field('operator', $._conop), field('right_operand', $._field_type), )), _datacon_record: $ => seq( field('name', $._constructor), field('fields', alias($._record_fields, $.fields)), ), _datacon_unboxed_sum: $ => unboxed_sum_single($, $.quantified_type), /** * Special constructors occurring in GHC code */ _datacon_special: $ => choice( $.unit, $.unboxed_unit, alias($._plist, $.empty_list), alias($._type_tuple, $.tuple), alias($._type_unboxed_tuple, $.unboxed_tuple), alias($._datacon_unboxed_sum, $.unboxed_sum), ), /** * data constructors only allow single foralls and contexts */ data_constructor: $ => seq( forall($), context($), field('constructor', choice( alias($._datacon_prefix, $.prefix), alias($._datacon_infix, $.infix), alias($._datacon_record, $.record), alias($._datacon_special, $.special), )), ), data_constructors: $ => sep1($._bar, field('constructor', $.data_constructor)), _data_rhs: $ => choice( $._kind_annotation, seq('=', field('constructors', $.data_constructors)), $._gadt, ), _data: $ => seq( context($), $._type_head, optional($._data_rhs), repeat(field('deriving', $.deriving)), ), data_type: $ => seq( optional('type'), 'data', $._data, ), // ------------------------------------------------------------------------ // newtype // ------------------------------------------------------------------------ _newtype_con_field: $ => $.type, newtype_constructor: $ => seq( field('name', $._con), field('field', choice( alias($._newtype_con_field, $.field), alias($._record_fields, $.record), )), ), _newtype: $ => seq( choice( seq('=', field('constructor', $.newtype_constructor)), $._gadt, ), repeat(field('deriving', $.deriving)), ), newtype: $ => seq( 'newtype', context($), $._type_head, $._newtype, ), // ------------------------------------------------------------------------ // data family // ------------------------------------------------------------------------ _datafam: $ => seq( $._type_head, optional($._kind_annotation), ), data_family: $ => seq( 'data', 'family', $._datafam, ), _inst_adt: $ => seq( forall($), context($), $._type_instance_head, optional($._data_rhs), repeat(field('deriving', $.deriving)), ), decl_inst_adt: $ => seq( 'data', 'instance', $._inst_adt, ), _inst_newtype: $ => seq( forall($), context($), $._type_instance_head, $._newtype, ), decl_inst_newtype: $ => seq( 'newtype', 'instance', $._inst_newtype, ), data_instance: $ => choice( alias($.decl_inst_adt, $.data_type), alias($.decl_inst_newtype, $.newtype), ), } ================================================ FILE: grammar/decl.js ================================================ const { sep1, sep2, parens, layout, } = require('./util.js') module.exports = { // ------------------------------------------------------------------------ // fixity // ------------------------------------------------------------------------ _fun_arrow_prec: _ => seq('-', '1'), // GHC.Types special decl _fun_arrow_fixity: $ => seq( field('associativity', 'infixr'), field('precedence', alias($._fun_arrow_prec, $.integer)), field('operator', alias('->', $.operator)), ), fixity: $ => choice( $._fun_arrow_fixity, seq( field('associativity', choice('infixl', 'infixr', 'infix')), field('precedence', optional($.integer)), field('operator', sep1(',', choice($._operator_minus, $._varop, $._conop))), ), ), // ------------------------------------------------------------------------ // signature // ------------------------------------------------------------------------ _con_binding_list: $ => sep2(',', field('name', $._con)), _var_binding_list: $ => sep2(',', field('name', $._var)), signature: $ => seq( choice( field('name', $._var), field('names', alias($._var_binding_list, $.binding_list)), ), $._type_annotation, ), // ------------------------------------------------------------------------ // function and pattern bind // ------------------------------------------------------------------------ _simple_bind_match: $ => seq('=', field('expression', $._exp)), _bind_match: $ => seq( $._guards, '=', $._cmd_texp_end, field('expression', $._exp), ), _bind_matches: $ => seq( choice( field('match', alias($._simple_bind_match, $.match)), repeat1(field('match', alias($._bind_match, $.match))), ), optional($._where_binds), ), _function_name: $ => field('name', $._var), function_head_parens: $ => parens( $, choice( $._function_head, $._function_head_patterns, ), ), _function_head_patterns: $ => choice( $._function_name, field('parens', $.function_head_parens), ), /** * The difference between a `function` with an `infix` head and a `bind` with `pat_infix` is that the former is for * _declaring_ a `varop` and the latter uses a `conop` to pattern match on the rhs expression. * The former may not have a type annotation, while the latter may. * * > a <> b = undefined * > h : t :: [Int] = undefined */ _function_head_infix: $ => seq( field('left_operand', $.pattern), optional($._cond_no_section_op), field('operator', choice(seq($._cond_minus, $._operator_minus), $._varop)), field('right_operand', $.pattern), ), _function_head: $ => choice( seq($._function_head_patterns, field('patterns', $.patterns)), alias($._function_head_infix, $.infix), ), function: $ => seq( $._function_head, $._bind_matches, ), /** * The `implicit_variable` here is for: * g = let ?par = Impy 5 in f */ bind: $ => prec('bind', seq( choice( field('pattern', $._pat), field('name', $._var), field('implicit', $.implicit_variable), ), $._bind_matches, )), /** * This is a supertype. */ decl: $ => choice( $.signature, $.function, $.bind, ), _local_decl: $ => choice( $.fixity, $.decl, ), local_binds: $ => layout($, field('decl', $._local_decl)), _where_binds: $ => seq($._where, optional(field('binds', $.local_binds))), // ------------------------------------------------------------------------ // foreign // ------------------------------------------------------------------------ calling_convention: _ => token(choice( 'ccall', 'stdcall', 'capi', 'prim', 'javascript', /[A-Z_]+/, // It's common in GHC to use a cpp #define for this )), safety: _ => token(choice( 'unsafe', 'safe', 'interruptible', )), entity: $ => $.string, foreign_import: $ => seq( 'foreign', 'import', field('calling_convention', $.calling_convention), optional(field('safety', $.safety)), optional(field('entity', $.entity)), field('signature', $.signature), ), foreign_export: $ => seq( 'foreign', 'export', field('calling_convention', $.calling_convention), optional(field('entity', $.entity)), field('signature', $.signature), ), // ------------------------------------------------------------------------ // default // ------------------------------------------------------------------------ default_types: $ => seq('default', parens($, optional(sep1(',', field('type', $._ktype))))), } ================================================ FILE: grammar/exp.js ================================================ const { sep1, sep, parens, braces, brackets, layout_sort, layout, unboxed_tuple_nonempty, unboxed_sum_single, qualified, } = require('./util.js') module.exports = { // ------------------------------------------------------------------------ // names // ------------------------------------------------------------------------ _exp_name: $ => choice( $._cons, $._vars, $.variable, $.implicit_variable, $.label, ), _exp_th_quoted_name: $ => choice( seq('\'', field('name', choice($._vars, $._cons))), prec('prefix', seq('\'\'', field('type', $.type))), ), // ------------------------------------------------------------------------ // tuples and parens // ------------------------------------------------------------------------ _exp_parens: $ => parens($, field('expression', $._exp)), // Having this separate reduces size by ~15kB _exp_tuple_elems: $ => seq( choice( seq(repeat1(','), field('element', $._exp)), seq(field('element', $._exp), ',', optional(field('element', $._exp))), ), repeat(seq(',', optional(field('element', $._exp)))) ), /** * This needs to be disambiguated from `prefix_tuple`, which is a constructor with _only_ commas. * Tuple sections aren't allowed in patterns. * * Since tuple expressions can contain singular expressions in sections like `(a,)` and `(,a)`, it has to be ensured * that there is _at least_ each one comma and one expression in there, but the comma may be on either side and be * preceded by any number of further commas, like `(,,,a)`. * * The final `repeat` is simpler, it just has to ensure that no two `_exp`s can be successive, but this encoding * means that the optional `_exp` after `(5,)` needs to be included in the `choice`, otherwise a simple pair * would be impossible. */ _exp_tuple: $ => parens($, $._exp_tuple_elems), /** * Unlike their boxed variants, unboxed tuples may be nullary and unary, making it simpler to parse them. */ _exp_unboxed_tuple: $ => unboxed_tuple_nonempty($, $._exp), /** * Unboxed sums must have at least one separating `|`, otherwise the expression would be a unary or nullary tuple. * This is a lenient parser that allows multiple variants to be filled in, for simplicity. */ _exp_unboxed_sum: $ => unboxed_sum_single($, $._exp), // ------------------------------------------------------------------------ // lists // ------------------------------------------------------------------------ _exp_list: $ => brackets($, sep1(',', field('element', $._exp)), optional(',')), /** * An expression like `[1,2..20]`. */ _exp_arithmetic_sequence: $ => brackets( $, field('from', $._exp), optional(seq(',', field('step', $._exp))), $._dotdot, optional(field('to', $._exp)), ), /** * `TransformListComp`, group style. * * Inlining `_exp` here is necessary to avoid a conflict. */ group: $ => seq( 'then', 'group', optional(seq('by', field('key', choice(alias($._exp_signature, $.signature), $.expression)))), 'using', field('classifier', $._exp), ), /** * `TransformListComp`, simple transformation style. */ transform: $ => seq( 'then', field('transformation', $._exp), optional(seq('by', field('key', $._exp))), ), qualifier: $ => choice( $.generator, $.let, $.transform, $.group, alias($._exp, $.boolean), ), /** * This is a supertype. */ qualifiers: $ => seq(sep1(',', field('qualifier', $.qualifier))), _exp_list_comprehension: $ => brackets( $, field('expression', $._exp), repeat1(seq('|', field('qualifiers', $.qualifiers))), ), // ------------------------------------------------------------------------ // greedy block args // ------------------------------------------------------------------------ _exp_lambda: $ => seq( '\\', field('patterns', $.patterns), $._arrow, field('expression', $._exp), ), _exp_let_in: $ => seq($._let, optional($._phantom_in), 'in', field('expression', $._exp)), _exp_conditional: $ => seq( 'if', field('if', $._exp), repeat(';'), 'then', field('then', $._exp), repeat(';'), 'else', field('else', $._exp), ), /** * These block arguments don't end in a layout, so they all range over all following block arguments and will * therefore always be the last argument in an application or infix chain. * They also pull a trailing type annotation into their body. */ _exp_greedy: $ => choice( alias($._exp_lambda, $.lambda), alias($._exp_let_in, $.let_in), alias($._exp_conditional, $.conditional), ), // ------------------------------------------------------------------------ // do // ------------------------------------------------------------------------ _exp_statement: $ => $._exp, /** * This is a supertype. */ statement: $ => choice( alias($._exp_statement, $.exp), alias($.generator, $.bind), $.let, $.rec, ), _statements: $ => layout_sort($, $._cmd_layout_start_do, field('statement', $.statement)), rec: $ => seq('rec', $._statements), _do_keyword: _ => choice('mdo', 'do'), do_module: $ => field('qualified_do', qualified($, $._do_keyword)), _do: $ => choice( $.do_module, $._do_keyword ), _exp_do: $ => seq($._do, $._statements), // ------------------------------------------------------------------------ // case // ------------------------------------------------------------------------ match: $ => seq( $._guards, optional($._phantom_arrow), $._arrow, $._cmd_texp_end, field('expression', $._exp), ), _simple_match: $ => seq($._arrow, field('expression', $._exp)), _matches: $ => field('match', choice( alias($._simple_match, $.match), repeat1($.match), )), alternative: $ => seq( field('pattern', $._pat), $._matches, optional($._where_binds), ), _nalt: $ => seq( field('patterns', $.patterns), $._matches, optional($._where_binds), ), alternatives: $ => layout_sort($, $._cmd_layout_start_case, field('alternative', $.alternative)), _nalts: $ => layout_sort($, $._cmd_layout_start_case, field('alternative', alias($._nalt, $.alternative))), _exp_case: $ => seq('case', $._exp, 'of', optional(field('alternatives', $.alternatives))), _exp_lambda_case: $ => seq( '\\', 'case', optional(field('alternatives', $.alternatives)), ), /** * alternatives are not optional in a `\cases` expression, but we're lenient. */ _exp_lambda_cases: $ => seq( '\\', 'cases', optional(field('alternatives', alias($._nalts, $.alternatives))), ), _exp_multi_way_if: $ => seq( 'if', $._cmd_layout_start_if, repeat(field('match', $.match)), $._cond_layout_end, ), // ------------------------------------------------------------------------ // record // ------------------------------------------------------------------------ field_update: $ => choice( alias('..', $.wildcard), seq( field('field', $._field_spec), optional(seq('=', field('expression', $._exp))) ), ), _exp_record: $ => prec('record', seq( field('expression', $.expression), braces($, sep(',', field('field', $.field_update)))), ), _exp_projection_selector: $ => parens( $, $._any_prefix_dot, field('field', $.variable), repeat(seq($._tight_dot, field('field', $.variable))), ), /** * A dot-syntax field projection like `var.name.othername`. */ _exp_projection: $ => seq( prec('projection', seq( field('expression', $.expression), $._tight_dot, )), field('field', $.field_name), ), // ------------------------------------------------------------------------ // application // ------------------------------------------------------------------------ explicit_type: $ => parens($, 'type', field('type', $.type)), _exp_apply: $ => prec.left('apply', seq( field('function', $.expression), field('argument', choice( $.expression, alias($._at_type, $.type_application), $.explicit_type, )), )), // ------------------------------------------------------------------------ // operators // ------------------------------------------------------------------------ _exp_op: $ => choice( $._sym, $._op_ticked, alias($._prefix_dot, $.operator), ), _exp_section_left: $ => parens( $, field('left_operand', $.expression), $._cond_left_section_op, field('operator', choice( $._exp_op, $._operator_minus, $._qsym, )), ), _exp_section_right: $ => parens( $, choice( alias($._operator_qual_dot_head, $.operator), $._ops, ), field('right_operand', $.expression), ), _exp_negation: $ => seq( field('minus', '-'), prec('negation', field('expression', $.expression)), ), /** * Infix expressions have severe conflicts with several structures: * * - Negation is supposed to bind less tight than application and tighter than infix, which requires an unsolvable * precedence configuration * - Qualified operators cannot be identified with single-token lookahead, which causes ambiguity with function * application * - Left operator sections require infix expressions in their operand to reduce before the section operator, but * single-token lookahead also makes this decision impossible * * All of these are solved with external symbols. * Consult `grammar/externals.js` for more information. */ _exp_infix: $ => prec.right('infix', seq( field('left_operand', $.expression), optional($._cond_no_section_op), field('operator', choice( seq($._cond_minus, $._operator_minus), $._exp_op, seq($._cond_qualified_op, $._qsym), )), field('right_operand', $.expression), )), // ------------------------------------------------------------------------ // top level // ------------------------------------------------------------------------ /** * This is a supertype. */ expression: $ => choice( alias($._exp_infix, $.infix), alias($._exp_negation, $.negation), alias($._exp_apply, $.apply), alias($._exp_record, $.record), alias($._exp_projection, $.projection), alias($._exp_arithmetic_sequence, $.arithmetic_sequence), alias($._exp_list_comprehension, $.list_comprehension), alias($._exp_unboxed_tuple, $.unboxed_tuple), alias($._exp_unboxed_sum, $.unboxed_sum), alias($._exp_projection_selector, $.projection_selector), alias($._exp_quote, $.quote), alias($._exp_typed_quote, $.typed_quote), alias($._exp_th_quoted_name, $.th_quoted_name), alias($._exp_lambda_case, $.lambda_case), alias($._exp_lambda_cases, $.lambda_cases), alias($._exp_do, $.do), alias($._exp_parens, $.parens), alias($._exp_tuple, $.tuple), alias($._exp_list, $.list), // Not using a name like "empty list" here because it's only really special in types. alias($._plist, $.list), alias($._exp_section_left, $.left_section), alias($._exp_section_right, $.right_section), $._exp_greedy, alias($._exp_case, $.case), alias($._exp_multi_way_if, $.multi_way_if), $._exp_name, $._universal, ), _exp_signature: $ => prec.right('annotated', seq( field('expression', $.expression), $._type_annotation, )), _exp: $ => choice( alias($._exp_signature, $.signature), // Right-associative means that the reduction of `expression` to `_exp` loses against any shift. prec.right($.expression), ), } ================================================ FILE: grammar/externals.js ================================================ module.exports = { /** * These rules are handled manually by the custom lexer in `src/scanner.c`. * Whenever the symbols are used in the rule tree, the parser executes the scanner. * Since several symbols are present both here and in `extras`, the scanner will be invoked before every single * natively lexed symbol, repeatedly, until it fails. * This makes indentation/layout tracking simpler. * * There are three special behavioral classes of symbols in this grammar, indicated by their name prefix: * * `cmd`: Commands are sequenced after key tokens like opening braces that unconditionally trigger a state change in * the scanner. * They don't require the scanner to _decide_ that a symbol is valid – the native parser has already committed * to a symbol, and the command relays that information to the scanner so it can update its state and return. * For example, after having parsed an opening brace, the scanner adds a brace context to the stack in reaction * to `_cond_brace_open`, which will influence its future behavior. * These symbols do not produce nodes in the parse tree. * * `cond`: Conditions are hard requirements in the grammar that are decided by the scanner based on its state and the * lookahead. * For example, whitespace-sensitive operators (tight infix /prefix ops) like the `@` in a type application or * the `.` in a record projection are lexed when the following characters have certain properties. * When the scanner decides that such a symbol is valid, the parser cannot attempt to use an alternative * interpretation like it can with conflicts. * This is often difficult, but also especially useful to force declarations and other layout items to be * terminated when a new line has smaller or equal indent, preventing incorrect interpretations as top level * expression splices spanning multiple lines. * * `phantom`: Phantom symbols are used to signal to the scanner that certain constructs are valid without requiring * the scanner to actually parse them and produce text nodes for them. * In the grammar, they are always optional, and the scanner never emits the phantom symbol itself, but * decides whether to emit _other_ symbols when the phantom symbol is _not_ valid. * This is used to implement GHC's tactic of allowing layouts to end _whenever a parse error occurs_, but * using specialized heuristics. * * Most other symbols produce nodes, except for newline and the error sentinel. */ externals: $ => [ // This is an unused symbol that indicates to the scanner that a parse error has occurred. // Tree-sitter marks _all_ symbols as valid when calling the scanner after an error, so a symbol that's not used in // the grammar is only valid if that is the case. $.error_sentinel, // Emitted after every newline with equal or less indent to terminate layout-based rules, with a few exceptions. $._cond_layout_semicolon, // Instruct the scanner to push a layout context. // The first one is for declarations and miscellaneous other layouts. // The others are for the specific syntax construct. // The quote layout is for declaration quotes (`[d|data A ...|]`). $._cmd_layout_start, $._cmd_layout_start_do, $._cmd_layout_start_case, $._cmd_layout_start_if, $._cmd_layout_start_let, $._cmd_layout_start_quote, // This variant is used in a `choice` with the others, and serves only to create a terminal node for explicit // braces. // If the scanner emitted the same symbol for virtual and explicit braces, we would either get an anonymous node // ranging over the brace, or a terminal brace node even for virtual starts if we were to alias the symbol to '{' // unconditionally. // So we use separate symbols and alias only this one. // The same reasoning applies to `_cond_layout_end_explicit`. // The terminal could be ensured in different ways – adding an `optional('{')` after the start symbol, using // `seq($._cmd_layout_start_explicit, '{')` instead of including the brace in the scanner range, or branching the // entire layout on the start token to unconditionally use `_cmd_brace_close` instead of // `_cond_layout_end_explicit`. // However, these solutions are all very expensive, adding between 500 and 1000kB to the shared object size, and up // to a second in generation time. $._cmd_layout_start_explicit, // Emitted when a new line's indent mandates ending the current layout (depending on the layout sort), or when a // special inline layout-ending token is encountered, like an `in`. $._cond_layout_end, $._cond_layout_end_explicit, // Instruct the scanner to push or pop a brace context. $._cmd_brace_open, $._cmd_brace_close, // Instruct the scanner to push or pop a tuple expression context. // In parenthesized or bracketed expressions, certain tokens (like commas, bars, and closing brackets), can end // layouts, so the scanner must be aware of them. $._cmd_texp_start, $._cmd_texp_end, // Signal to the scanner that these symbols are valid. // See the explanation of phantom symbols above. $._phantom_where, $._phantom_in, $._phantom_arrow, $._phantom_bar, $._phantom_deriving, // Detect and emit text nodes for comments and CPP. // In particular, #else branches of CPP conditionals a fully contained in the resulting node, since their nonlinear // nature means they cannot be parsed. $.comment, $.haddock, $.cpp, $.pragma, // Starting quote brackets are a bit messy, so it's easier to let the scanner signal that it encountered one. // The body produces a text node until the ending bracket. $._cond_quote_start, $.quasiquote_body, // Whitespace-sensitive operators for splices (`$`, `$$`), projection and module dots (`a.b`, `A.b`), arithmetic // sequence dots `[1..10]`, as-pattern (`a@(Just b)`), type application (`@Int`), strictness and laziness // annotations (`!pat`, `~Int`), and modifiers (`Int %1 -> Int`). $._cond_splice, $._cond_qual_dot, $._cond_tight_dot, $._cond_prefix_dot, $._cond_dotdot, $._cond_tight_at, $._cond_prefix_at, $._cond_tight_bang, $._cond_prefix_bang, $._cond_tight_tilde, $._cond_prefix_tilde, $._cond_prefix_percent, // GHC lexes all qualified names as atomic tokens, but we can't do that because we need nodes for their // substructures. // However, infix expressions need single-token lookahead for the operator to resolve conflicts, which is // impossible without an external. // This symbol detects a qualified symbolic operator. $._cond_qualified_op, // This one performs an additional lookahead check for a following closing parenthesis, to disambiguate left // sections from infix ops in `(a - b +)`. $._cond_left_section_op, // This is an auxiliary for `_cond_left_section_op` that allows restarting the scanner without that symbol being // valid again when whitespace was skipped after a symop to discover that there's no parenthesis. // Without this, we would get wrong token ranges for the operator. $._cond_no_section_op, // This symbol always succeeds when a minus is ahead. // Infix expressions with minus as the operator conflict with function application. // `a - b` can be parsed as `a (- b)`, which would normally be solved by a simple precedence entry, but is // impossible to express because it contradicts another conflict: Negation in the left operand, `- a + b`, which // must be parsed as `(- a) + b`. // Simply sequencing this external before the operator solves this conflict, because a minus following an expression // can never be negation; it can only occur at the beginning of an expression. $._cond_minus, /** * The following symbols perform lookahead for various type constructs to resolve conflicts between infix types, * contexts, and type/datacon heads, because using GLR conflicts for these is very brittle and frequently leads to * misparsed trees. * * See the documentation under 'Constraints' in `src/scanner.c` for more. */ $._cond_context, $._cond_infix, $._cond_data_infix, $._cond_assoc_tyinst, // Symbolic operators, producing text nodes. // These are very difficult to parse in the grammar, because unlike most languages, Haskell's operators are not a // finite set, and therefore cannot be lexically disambiguated from special operators like `->`. // In the presence of runtime conflicts, this can easily lead to the invalid interpretation of reserved operators as // identifiers. // Furthermore, the regexes for all the unicode categories produce very large ternary operator trees if specified // in the grammar. $._varsym, $._consym, // The newline is used as a dummy symbol that is emitted whenever the scanner has to update its state even though // the current position must be parsed by the grammar. /\n/, ], } ================================================ FILE: grammar/general.js ================================================ const { sep1, layout_sort, } = require('./util.js') module.exports = { // ------------------------------------------------------------------------ // guard // ------------------------------------------------------------------------ generator: $ => seq( field('pattern', $._pat), field('arrow', $._larrow), field('expression', $._exp), ), _let_binds: $ => layout_sort($, $._cmd_layout_start_let, field('decl', $.decl)), _let: $ => seq('let', optional(field('binds', alias($._let_binds, $.local_binds)))), let: $ => $._let, /** * This is a supertype. */ guard: $ => choice( // Cannot be named `pattern` because name clash. alias($.generator, $.pattern_guard), $.let, alias($._exp, $.boolean), ), guards: $ => sep1(',', field('guard', $.guard)), _guards: $ => seq( $._bar, $._cmd_texp_start, field('guards', $.guards), ), // ------------------------------------------------------------------------ // rules shared by expression, pattern, type // ------------------------------------------------------------------------ _universal: $ => choice( $.splice, $.quasiquote, $.literal, $._unit_cons, $._tuple_cons, ), } ================================================ FILE: grammar/id.js ================================================ const { parens, ticked, promoted, qualified, } = require('./util.js') module.exports = { // ------------------------------------------------------------------------ // var // ------------------------------------------------------------------------ _qualified_variable: $ => qualified($, $.variable), _qvarid: $ => alias($._qualified_variable, $.qualified), _varids: $ => choice($._qvarid, $.variable), _var: $ => choice($.variable, $._pvarsym), _qvar: $ => choice($._qvarid, $._pqvarsym), _vars: $ => choice($._var, $._qvar), _variable_ticked: $ => ticked($.variable), _varop: $ => choice($.operator, alias($._variable_ticked, $.infix_id)), _qvariable_ticked: $ => ticked($._qvarid), _varids_ticked: $ => alias( choice( $._variable_ticked, $._qvariable_ticked, ), $.infix_id, ), // ------------------------------------------------------------------------ // con // ------------------------------------------------------------------------ _constructor: $ => alias($.name, $.constructor), _qualified_constructor: $ => qualified($, $._constructor), _qconid: $ => alias($._qualified_constructor, $.qualified), _conids: $ => choice($._qconid, $._constructor), _con: $ => choice($._constructor, $._pconsym), _qcon: $ => choice($._qconid, $._pqconsym), _cons: $ => choice(prec('con', $._con), $._qcon), _constructor_ticked: $ => ticked($._constructor), _conop: $ => choice($._constructor_operator_alias, alias($._constructor_ticked, $.infix_id)), _qconstructor_ticked: $ => ticked($._qconid), _conids_ticked: $ => alias( choice( $._constructor_ticked, $._qconstructor_ticked, ), $.infix_id, ), // ------------------------------------------------------------------------ // tycon // ------------------------------------------------------------------------ _tyconid: $ => $.name, _qualified_type: $ => qualified($, $._tyconid), _qtyconid: $ => alias($._qualified_type, $.qualified), _tyconids: $ => choice($._qtyconid, $._tyconid), _tycon_arrow: $ => parens($, alias($._arrow, $.operator)), _qualified_arrow: $ => qualified($, alias($._arrow, $.operator)), _qtycon_arrow: $ => parens($, alias($._qualified_arrow, $.qualified)), _tycon: $ => choice($._tyconid, $._pvarsym, alias($._tycon_arrow, $.prefix_id), $._pconsym), _qtycon: $ => choice($._qtyconid, alias($._qtycon_arrow, $.prefix_id), $._pqsym), _tycons: $ => choice($._tycon, $._qtycon), _promoted_tycons_alias: $ => seq('\'', $._cons), _promoted_tycons: $ => alias($._promoted_tycons_alias, $.promoted), _tycon_ticked: $ => ticked($._tyconid), _qtycon_ticked: $ => ticked($._qtyconid), _tyconids_ticked: $ => alias( choice( $._tycon_ticked, $._qtycon_ticked, ), $.infix_id, ), _tyconops: $ => choice( $._sym, $._qsym, $._operator_minus, $._tyconids_ticked, ), /** * Lenient parsing: `varsym` is not legal (like `'++`). */ _promoted_tyconops_alias: $ => promoted($._tyconops), _promoted_tyconops: $ => alias($._promoted_tyconops_alias, $.promoted), _tyops: $ => choice( $._tyconops, $._promoted_tyconops, ), // ------------------------------------------------------------------------ // op // ------------------------------------------------------------------------ _op_ticked: $ => choice( $._varids_ticked, $._conids_ticked, ), _ops: $ => choice( $.operator, $._qvarsym, $.constructor_operator, $._qconsym, $._op_ticked, ), _name: $ => choice($._var, $._con), _qname: $ => choice($._vars, $._cons), } ================================================ FILE: grammar/inline.js ================================================ module.exports = { inline: $ => [ // ------------------------------------------------ // variable // ------------------------------------------------ $._var, $._vars, $._varids, $._varids_ticked, $._varop, // ------------------------------------------------ // constructor // ------------------------------------------------ $._constructor, $._con, $._qcon, $._cons, $._conids, $._conids_ticked, $._conop, $._op_ticked, $._modid, // ------------------------------------------------ // operator // ------------------------------------------------ $._qvarsym, $._qconsym, $._sym, $._qsym, $._pqsym, $._any_prefix_dot, $._any_tight_dot, $._unboxed_bar, // ------------------------------------------------ // expression // ------------------------------------------------ $._exp_name, $._exp_greedy, $._let, // ------------------------------------------------ // pattern // ------------------------------------------------ $._pat_apply_arg, $._pat_name, $._pat_texp, // ------------------------------------------------ // type // ------------------------------------------------ $._tyconid, $._tyconids, $._tycon, $._qtycon, $._tycons, $._tyconops, $._tyops, $._type_name, $._forall, $._type_apply_arg, $._parameter_type, $._field_type, $._type_head, $._type_instance_head, $._type_annotation, $._kind_annotation, // ------------------------------------------------ // literal // ------------------------------------------------ $._number, $._stringly, $._unit_cons, $._tuple_cons, $._universal, // ------------------------------------------------ // decl // ------------------------------------------------ $._function_head_patterns, $._function_head, ], } ================================================ FILE: grammar/lexeme.js ================================================ const id_char = /[\pL\p{Mn}\pN_']*/ const varid_start_char = /[_\p{Ll}\p{Lo}]/ const conid_start_char = /[\p{Lu}\p{Lt}]/ module.exports = { variable: _ => token(seq(varid_start_char, id_char, /#*/)), implicit_variable: _ => token(seq('?', varid_start_char, id_char)), name: _ => token(seq(conid_start_char, id_char, /#*/)), label: _ => token(seq('#', varid_start_char, id_char)), _carrow: _ => choice('=>', '⇒'), _arrow: _ => choice('->', '→'), _linear_arrow: _ => choice('->.', '⊸'), _larrow: _ => choice('<-', '←'), _colon2: _ => choice('::', '∷'), _promote: _ => '\'', _qual_dot: $ => seq($._cond_qual_dot, '.'), _tight_dot: $ => seq($._cond_tight_dot, '.'), _any_tight_dot: $ => choice($._qual_dot, $._tight_dot), _prefix_dot: $ => seq($._cond_prefix_dot, '.'), _any_prefix_dot: $ => choice($._qual_dot, $._prefix_dot), _tight_at: $ => seq($._cond_tight_at, '@'), _prefix_at: $ => seq($._cond_prefix_at, '@'), _prefix_bang: $ => seq($._cond_prefix_bang, '!'), _tight_bang: $ => seq($._cond_tight_bang, '!'), _any_prefix_bang: $ => choice($._prefix_bang, $._tight_bang), _prefix_tilde: $ => seq($._cond_prefix_tilde, '~'), _tight_tilde: $ => seq($._cond_tight_tilde, '~'), _any_prefix_tilde: $ => choice($._prefix_tilde, $._tight_tilde), _prefix_percent: $ => seq($._cond_prefix_percent, '%'), _dotdot: $ => seq($._cond_dotdot, '..'), _paren_open: $ => seq(alias(/\(/, '('), $._cmd_texp_start), _paren_close: $ => seq(alias(/\)/, ')'), $._cmd_texp_end), _bracket_open: $ => seq('[', $._cmd_texp_start), _bracket_close: $ => seq(']', $._cmd_texp_end), // Sadly, this does not have the effect of creating a single terminal for the bracket :'( _unboxed_open: $ => alias(seq($._paren_open, token.immediate('#')), '(#'), _unboxed_close: $ => seq('#)', $._cmd_texp_end), _unboxed_bar: _ => choice('|', token.immediate('|')), _where: $ => seq(optional($._phantom_where), 'where'), _bar: $ => seq(optional($._phantom_bar), '|'), } ================================================ FILE: grammar/literal.js ================================================ const { parens, brackets, unboxed, } = require('./util.js') const decimal = /[0-9][0-9_]*/ const exponent = /[eE][+-]?[0-9_]+/ const hex_exponent = /[pP][+-]?[0-9a-fA-F_]+/ const magic_hash = rule => token(seq(rule, optional(token.immediate(/##?/)))) module.exports = { // ------------------------------------------------------------------------ // literals // ------------------------------------------------------------------------ // the `choice` here is necessary to avoid integers being parsed as floats float: _ => magic_hash( seq( decimal, choice( seq(/\.[0-9_]+/, optional(exponent)), exponent, ), ), ), char: _ => magic_hash( choice( /'[^']'/, /'\\[^ ]*'/, ), ), string: _ => magic_hash( seq( '"', repeat(choice( /[^\\"\n]/, /\\(\^)?./, /\\\n\s*\\/, )), '"', ), ), _integer_literal: _ => magic_hash(decimal), _binary_literal: _ => magic_hash(/0[bB][01_]+/), _octal_literal: _ => magic_hash(/0[oO][0-7]+/), _hex_literal: _ => magic_hash( seq( /0[xX][0-9a-fA-F_]+/, optional(/\.[0-9a-fA-F_]+/), optional(hex_exponent), ) ), integer: $ => choice( $._binary_literal, $._integer_literal, $._octal_literal, $._hex_literal, ), _stringly: $ => choice( $.string, $.char, ), _number: $ => choice( $.integer, $.float, ), _plist: $ => brackets($), unit: $ => parens($), unboxed_unit: $ => unboxed($), prefix_tuple: $ => parens($, repeat1(',')), prefix_unboxed_tuple: $ => unboxed($, repeat1(',')), prefix_unboxed_sum: $ => unboxed($, repeat1($._unboxed_bar)), literal: $ => choice( $._stringly, $._number, ), _unit_cons: $ => choice( $.unit, $.unboxed_unit, ), _tuple_cons: $ => choice( $.prefix_tuple, $.prefix_unboxed_tuple, $.prefix_unboxed_sum, ), } ================================================ FILE: grammar/module.js ================================================ const { sep1, sep, parens, semi, semi_opt, semis, } = require('./util.js') module.exports = { // ------------------------------------------------------------------------ // module names // ------------------------------------------------------------------------ _modid: $ => alias($.name, $.module_id), _modid_prefix: $ => prec('qualifying-module', seq($._modid, $._any_tight_dot)), _qualifying_module: $ => repeat1($._modid_prefix), module: $ => seq(repeat($._modid_prefix), $._modid), // ------------------------------------------------------------------------ // import/export // ------------------------------------------------------------------------ namespace: _ => choice('pattern', 'type'), _child_type: $ => seq(field('namespace', 'type'), field('type', $._tyconids)), _child: $ => choice( alias($._child_type, $.associated_type), $._qname, ), children: $ => parens($, sep(',', field('element', choice(alias('..', $.all_names), $._child)))), _ie_entity: $ => seq( optional(field('namespace', $.namespace)), choice( field('variable', $._varids), field('type', $._tyconids), field('operator', choice($._sym_prefix, $._pqsym)), ), optional(field('children', $.children)), ), // ------------------------------------------------------------------------ // import // ------------------------------------------------------------------------ import_list: $ => parens( $, sep(',', field('name', alias($._ie_entity, $.import_name))), optional(','), ), import: $ => seq( 'import', optional('qualified'), optional(field('package', alias($.string, $.import_package))), field('module', $.module), optional('qualified'), optional(seq('as', field('alias', $.module))), optional(seq( optional('hiding'), field('names', $.import_list), )), ), // ------------------------------------------------------------------------ // export // ------------------------------------------------------------------------ module_export: $ => seq('module', field('module', $.module)), exports: $ => parens( $, optional(sep1(',', choice(field('export', alias($._ie_entity, $.export)), $.module_export))), optional(','), ), // ------------------------------------------------------------------------ // module body / sections // ------------------------------------------------------------------------ header: $ => seq( 'module', field('module', $.module), field('exports', optional($.exports)), $._where, ), imports: $ => seq(semis($, field('import', $.import)), semi($)), /** * Using `semi` at the end instead of `semi_opt` increases parser size by a full megabyte!! * * This allows imports after the first declaration to prevent the tree from jittering while typing an import: * * > import A * > imp * > import B * * The partially typed `imp` will be parsed as a `top_splice`, which forces `imports` to reduce after `import A`. * The rest of the file will then be part of `declarations` and all following imports will be broken until the keyword * has been completed. */ declarations: $ => seq($.declaration, repeat(seq(semi($), choice($.declaration, $.import))), semi_opt($)), _body: $ => seq( choice($._cmd_layout_start, alias($._cmd_layout_start_explicit, '{')), semi_opt($), field('imports', optional($.imports)), field('declarations', optional($.declarations)), $._layout_end, ), _layout_end: $ => choice( $._cond_layout_end, alias($._cond_layout_end_explicit, '}'), ), /** * This is a supertype. */ declaration: $ => choice( $.decl, $.type_synomym, $.kind_signature, $.type_family, $.type_instance, $.role_annotation, $.data_type, $.newtype, $.data_family, $.data_instance, $.class, $.instance, $.default_types, $.deriving_instance, $.pattern_synonym, $.foreign_import, $.foreign_export, $.fixity, $.top_splice, ), } ================================================ FILE: grammar/operator.js ================================================ const { parens, qualified, } = require('./util.js') module.exports = { // ------------------------------------------------------------------------ // var // ------------------------------------------------------------------------ _operator_qual_dot_head: $ => seq($._cond_qual_dot, $._varsym), _operator_hash_head: _ => seq( choice('#', token.immediate('#')), optional(choice(token.immediate('#'), token.immediate('|'))), ), operator: $ => choice( seq(optional($._cond_prefix_dot), $._varsym), $._operator_hash_head, '*', ), _operator_alias: $ => $.operator, _operator_minus: $ => alias('-', $.operator), _varsym_prefix: $ => parens( $, choice( $.operator, $._operator_minus, alias($._operator_qual_dot_head, $.operator), ), ), _pvarsym: $ => alias($._varsym_prefix, $.prefix_id), _qualified_varsym: $ => qualified($, choice($.operator, $._operator_minus)), _qvarsym: $ => alias($._qualified_varsym, $.qualified), _qvarsym_prefix: $ => parens($, $._qvarsym), _pqvarsym: $ => alias($._qvarsym_prefix, $.prefix_id), // ------------------------------------------------------------------------ // con // ------------------------------------------------------------------------ constructor_operator: $ => $._consym, _constructor_operator_alias: $ => $.constructor_operator, _consym_prefix: $ => parens($, $.constructor_operator), _pconsym: $ => alias($._consym_prefix, $.prefix_id), _qualified_consym: $ => qualified($, $.constructor_operator), _qconsym: $ => alias($._qualified_consym, $.qualified), _qconsym_prefix: $ => parens($, $._qconsym), _pqconsym: $ => alias($._qconsym_prefix, $.prefix_id), // ------------------------------------------------------------------------ // op // ------------------------------------------------------------------------ _sym: $ => choice($._operator_alias, $._constructor_operator_alias), _sym_prefix: $ => choice($._pvarsym, $._pconsym), _qsym: $ => choice($._qvarsym, $._qconsym), _pqsym: $ => choice($._pqvarsym, $._pqconsym), } ================================================ FILE: grammar/pat.js ================================================ const { sep1, sep2, sep, parens, braces, brackets, unboxed_tuple_full, unboxed_sum_single, } = require('./util.js') module.exports = { // ------------------------------------------------------------------------ // tuples and parens // ------------------------------------------------------------------------ _pat_parens: $ => parens($, field('pattern', $._pat_texp)), _pat_tuple_elems: $ => sep2(',', field('element', $._pat_texp)), _pat_tuple: $ => parens($, $._pat_tuple_elems), _pat_unboxed_tuple: $ => unboxed_tuple_full($, $._pat_texp), _pat_unboxed_sum: $ => unboxed_sum_single($, $._pat_texp), _pat_list: $ => brackets($, sep1(',', field('element', $._pat_texp)), optional(',')), // ------------------------------------------------------------------------ // record // ------------------------------------------------------------------------ field_pattern: $ => choice( alias('..', $.wildcard), seq(field('field', $._field_names), optional(seq('=', field('pattern', $._pat_texp)))), ), _pat_record: $ => prec('record', seq( field('constructor', $.pattern), braces($, sep(',', field('field', $.field_pattern))), )), // ------------------------------------------------------------------------ // misc // ------------------------------------------------------------------------ /** * This dynamic precedence penalty is relevant for the conflict between `function` and `bind`. * Consider: * * > f (A a) = exp * * Because of the "single choice disambiguated with named precedences" approach used for `pattern`, the left node in * `pat_apply` can be a variable, even though it's not valid Haskell. * While the static prec 'pat-name' covers this at generation time, Haskell's ambiguity requires us to use a runtime * conflict for `function`/`bind`, where static prec is ineffective. * Giving the reduction of `_var` to `pattern` a strong negative dynamic prec ensures that the runtime branch for * `bind` has lower precedence because of `f`, so `function` always wins. * * While `bind` usually has a lower score than `function` anyway in this situation because it is slightly more * complex, there are never any guarantees for runtime conflicts. * In particular, the presence of minor parse errors later in the declaration can tip the scales randomly. */ _pat_name: $ => choice( prec('pat-name', prec.dynamic(-1000, $._var)), $._cons, ), _pat_as: $ => prec('prefix', seq(field('bind', $.variable), $._tight_at, field('pattern', $.pattern))), _pat_wildcard: _ => '_', _pat_strict: $ => prec('prefix', seq($._any_prefix_bang, field('pattern', $.pattern))), _pat_irrefutable: $ => prec('prefix', seq($._any_prefix_tilde, field('pattern', $.pattern))), // ------------------------------------------------------------------------ // application // ------------------------------------------------------------------------ _pat_apply_arg: $ => choice( $.pattern, alias($._at_type, $.type_binder), $.explicit_type, ), _pat_apply: $ => prec.left('apply', seq( field('function', $.pattern), field('argument', $._pat_apply_arg), )), // ------------------------------------------------------------------------ // operators // ------------------------------------------------------------------------ _pat_negation: $ => seq('-', field('number', $._number)), _pat_infix: $ => prec.right('infix', seq( field('left_operand', $.pattern), optional($._cond_no_section_op), field('operator', choice( $.constructor_operator, $._conids_ticked, seq($._cond_qualified_op, $._qconsym), )), field('right_operand', $.pattern), )), // ------------------------------------------------------------------------ // top level // ------------------------------------------------------------------------ pattern: $ => choice( alias($._pat_infix, $.infix), alias($._pat_negation, $.negation), alias($._pat_apply, $.apply), $._pat_name, alias($._pat_as, $.as), alias($._pat_record, $.record), alias($._pat_wildcard, $.wildcard), alias($._pat_parens, $.parens), alias($._pat_tuple, $.tuple), alias($._pat_unboxed_tuple, $.unboxed_tuple), alias($._pat_unboxed_sum, $.unboxed_sum), alias($._pat_list, $.list), alias($._plist, $.list), alias($._pat_strict, $.strict), alias($._pat_irrefutable, $.irrefutable), $._universal, ), patterns: $ => repeat1(prec('patterns', $._pat_apply_arg)), _pat_signature: $ => prec.right('annotated', seq( field('pattern', $.pattern), $._type_annotation, )), _pat: $ => choice( alias($._pat_signature, $.signature), prec.right($.pattern), ), view_pattern: $ => seq(field('expression', $._exp), $._arrow, field('pattern', $._pat_texp)), _pat_texp: $ => choice($.view_pattern, $._pat), } ================================================ FILE: grammar/patsyn.js ================================================ const { layout, optional_where, } = require('./util.js') module.exports = { // ------------------------------------------------------------------------ // pattern synonym // ------------------------------------------------------------------------ _patsyn_signature: $ => seq( field('synonym', choice($._con, alias($._con_binding_list, $.binding_list))), $._colon2, field('type', $.quantified_type), ), _patsyn_cons: $ => layout($, alias($.bind, $.constructor_synonym)), /** * This allows a `where` after any equation for parsing resilience, even though it's only valid for the arrow variant * (explicitly bidirectional patterns). * The `where` may also be empty. */ _patsyn_equation: $ => seq( field('synonym', $.pattern), choice( '=', $._larrow, ), field('pattern', $._pat), optional_where($, field('constructors', alias($._patsyn_cons, $.constructor_synonyms))), ), pattern_synonym: $ => seq( 'pattern', choice( alias($._patsyn_signature, $.signature), alias($._patsyn_equation, $.equation), ), ), } ================================================ FILE: grammar/precedences.js ================================================ module.exports = { precedences: $ => [ // ------------------------------------------------ // associativity of expressions, patterns and types // ------------------------------------------------ [ 'projection', 'record', 'prefix', 'apply', 'negation', 'infix', 'implicit', 'fun', 'annotated', $.quantified_type, ], // ------------------------------------------------ // negation // ------------------------------------------------ [ $._pat_negation, $.literal, ], // ------------------------------------------------ // function vs bind // ------------------------------------------------ [ 'bind', 'pat-name', ], // ------------------------------------------------ // qualified names // ------------------------------------------------ /** * Prioritize shifting over a tight infix dot over reducing to a qualified constructor or module. */ [ 'qualifying-module', 'qualified-id', ], /** * Prioritize qualified variables over record field projection on constructors. */ [ 'qualifying-module', 'con', ], /** * Prioritize qualified names over the infix operator dot in types. */ [ 'qualifying-module', 'type-name', ], // ------------------------------------------------ // types and constraints // ------------------------------------------------ [ $.operator, $._type_star, ], [ $._type_wildcard, $._type_param_wildcard, ], [ $._constructor_ticked, $._tycon_ticked, ], [ 'qtype-single', 'qtype-curried', ], // ------------------------------------------------ // misc // ------------------------------------------------ /** * > f A a a = a * > data A = A Int Int * * This should not be parsed as constructor application, but separate patterns. */ [ 'patterns', 'apply', ], ], } ================================================ FILE: grammar/th.js ================================================ const { layout_sort, } = require('./util.js') const quote_bracket = ($, quoter) => seq( $._cond_quote_start, '[', field('quoter', quoter), '|', ) module.exports = { // ------------------------------------------------------------------------ // splice // ------------------------------------------------------------------------ /** * Even though the doc states "arbitrary expression", it's very rare for any others than names and parenthesized * expressions to occur, and it's very expensive to allow them. * Even only allowing list and quotes adds a full megabyte to the parser size. */ _splice_exp: $ => choice( $._exp_name, alias($._exp_parens, $.parens), $.literal, ), _splice_dollars: $ => seq( $._cond_splice, choice('$', '$$'), ), splice: $ => seq($._splice_dollars, field('expression', $._splice_exp)), /** * Since `expression` includes `splice`, this allows for a top level dollar splice as well. */ top_splice: $ => $.expression, quoter: $ => $._varids, /** * `_cond_quote_start` (in `quote_bracket`) is a zero-width token emitted by the scanner. * While the quoter and the bar may not be preceded by whitespace, this is not necessary to ensure here with * `token.immediate` since the scanner already verifies it. */ quasiquote: $ => seq( quote_bracket($, $.quoter), optional(field('body', $.quasiquote_body)), choice(token('|]'), '⟧'), ), quoted_decls: $ => layout_sort($, $._cmd_layout_start_quote, field('declaration', $.declaration)), /** * An "expression quotation" is valid in an expression, and its body may contain an expression, type, pattern or * declaration layout. * * Which of these are valid is decided by the quoter: `e`, `t`, `p` or `d`. * If the quoter is empty, or the special oxford bracket character is used, the body is parsed as an expression. */ _exp_quote: $ => seq( choice( seq(choice('⟦', quote_bracket($, optional('e'))), optional(alias($._exp, $.quoted_expression))), seq(quote_bracket($, 't'), optional(alias($._ktype, $.quoted_type))), seq(quote_bracket($, 'p'), optional(alias($._pat, $.quoted_pattern))), seq(quote_bracket($, 'd'), optional($.quoted_decls)), ), choice(token('|]'), '⟧'), ), _exp_typed_quote: $ => seq( $._cond_quote_start, '[', optional('e'), '||', optional(alias($._exp, $.quoted_expression)), token('||]'), ), } ================================================ FILE: grammar/type.js ================================================ const { parens, braces, brackets, prefix_at, sep1, sep2, unboxed_tuple_full, unboxed_sum_full, forall, layout, layout_single, optional_where, } = require('./util.js') module.exports = { // ------------------------------------------------------------------------ // type parameters // ------------------------------------------------------------------------ _inferred_tyvar: $ => braces($, $._ktype_param), _type_param_parens: $ => parens($, $._ktype_param), _type_param_wildcard: _ => '_', _type_param_annotated: $ => prec('annotated', seq($.type_param, $._kind_annotation)), _type_param_invisible: $ => prefix_at($, field('bind', $.type_param)), /** * This is a supertype. */ type_param: $ => choice( alias($._type_param_wildcard, $.wildcard), alias($._type_param_invisible, $.invisible), alias($._type_param_parens, $.parens), field('bind', $.variable), ), _ktype_param: $ => choice( $.type_param, alias($._type_param_annotated, $.annotated), ), type_params: $ => repeat1(prec('patterns', $.type_param)), quantified_variables: $ => repeat1(choice($.type_param, alias($._inferred_tyvar, $.inferred))), // ------------------------------------------------------------------------ // tuples and parens // ------------------------------------------------------------------------ _type_parens: $ => parens($, field('type', $._ktype)), _type_tuple_elems: $ => sep2(',', field('element', $._ktype)), /** * Tuple types must either be saturated or empty, sections aren't legal. * We could be lenient here, but it seems useful to have a different node name for the prefix variant. */ _type_tuple: $ => parens($, $._type_tuple_elems), _type_unboxed_tuple: $ => unboxed_tuple_full($, $._ktype), _type_unboxed_sum: $ => unboxed_sum_full($, $._ktype), _type_list: $ => brackets($, sep1(',', field('element', $._ktype))), // ------------------------------------------------------------------------ // names etc // ------------------------------------------------------------------------ _type_promoted: $ => seq( '\'', choice( alias($._plist, $.empty_list), alias($._type_tuple, $.tuple), alias($._type_list, $.list), $.prefix_tuple, $.unit, ), ), _type_name: $ => choice( $.variable, $._promoted_tycons, prec('type-name', $._tycons), ), _type_star: _ => choice('*', '★'), _type_wildcard: _ => '_', // ------------------------------------------------------------------------ // application // ------------------------------------------------------------------------ _at_type: $ => prefix_at($, field('type', $.type)), _type_apply_arg: $ => choice($.type, alias($._at_type, $.kind_application)), /** * Type application, as in `Either e (Int, Text)` or `TypeRep @Int`. */ _type_apply: $ => prec.left('apply', seq( field('constructor', $.type), field('argument', $._type_apply_arg), )), // ------------------------------------------------------------------------ // infix // ------------------------------------------------------------------------ _type_infix: $ => prec.right('infix', seq( field('left_operand', $.type), field('operator', $._tyops), field('right_operand', $.type), )), // ------------------------------------------------------------------------ // unquantified type // ------------------------------------------------------------------------ /** * This is a supertype. */ type: $ => choice( $._type_name, alias($._type_star, $.star), alias($._type_wildcard, $.wildcard), alias($._type_parens, $.parens), alias($._type_promoted, $.promoted), alias($._type_list, $.list), alias($._plist, $.prefix_list), alias($._type_unboxed_tuple, $.unboxed_tuple), alias($._type_unboxed_sum, $.unboxed_sum), alias($._type_tuple, $.tuple), alias($._type_infix, $.infix), alias($._type_apply, $.apply), $._universal, ), // ------------------------------------------------------------------------ // forall // ------------------------------------------------------------------------ _forall_keyword: _ => choice('forall', '∀'), _forall_body: $ => seq( field('quantifier', $._forall_keyword), optional(field('variables', $.quantified_variables)), ), forall: $ => prec('qtype-single', seq( $._forall_body, '.', )), forall_required: $ => prec('qtype-single', seq( $._forall_body, $._arrow, )), _forall: $ => choice( $.forall, $.forall_required, ), _qtype_forall: $ => prec.right('qtype-curried', seq( $._forall_body, '.', field('type', $.quantified_type), )), _qtype_forall_required: $ => prec.right('qtype-curried', seq( $._forall_body, $._arrow, field('type', $.quantified_type), )), // ------------------------------------------------------------------------ // function // ------------------------------------------------------------------------ _fun_arrow: $ => seq( optional($._phantom_arrow), field('arrow', $._arrow), ), modifier: $ => prec('prefix', seq($._prefix_percent, $.type)), _linear_fun_arrow: $ => choice( seq( field('multiplicity', $.modifier), $._fun_arrow, ), seq( optional($._phantom_arrow), field('arrow', $._linear_arrow), ), ), /** * These also allow tight infix because unpack pragmas can precede them without space. * Technically pragmas aren't considered for tight infix, but it's simpler to do it this way than to track that in the * scanner. */ strict_field: $ => prec('prefix', seq($._any_prefix_bang, field('type', $.type))), lazy_field: $ => prec('prefix', seq($._any_prefix_tilde, field('type', $.type))), _parameter_type: $ => field('parameter', choice($.strict_field, $.lazy_field, $.quantified_type)), /** * We allow strict and lazy field types in function types so that GADTs don't need a separate rule tree. */ _qtype_function: $ => prec.right(seq( $._parameter_type, $._fun_arrow, field('result', $.quantified_type), )), _qtype_linear_function: $ => prec.right(seq( $._parameter_type, $._linear_fun_arrow, field('result', $.quantified_type), )), // ------------------------------------------------------------------------ // context // ------------------------------------------------------------------------ _qtype_context: $ => prec.right('qtype-curried', seq( $._context_inline, field('type', $.quantified_type), )), // ------------------------------------------------------------------------ // top level // ------------------------------------------------------------------------ /** * This is a supertype. */ quantified_type: $ => choice( alias($._qtype_function, $.function), alias($._qtype_linear_function, $.linear_function), alias($._qtype_forall, $.forall), alias($._qtype_forall_required, $.forall_required), alias($._qtype_context, $.context), $.implicit_parameter, prec.right($.type), ), _type_annotation: $ => seq( $._colon2, field('type', $.quantified_type), ), _kind_annotation: $ => seq( $._colon2, field('kind', $.quantified_type), ), _type_signature: $ => prec.right('annotated', seq( field('type', $.quantified_type), $._kind_annotation, )), _ktype: $ => choice( alias($._type_signature, $.signature), $.quantified_type, ), // ------------------------------------------------------------------------ // type head // ------------------------------------------------------------------------ _type_head_name: $ => field('name', choice( $._tycon, $.unit, alias($._plist, $.prefix_list), )), _type_head_parens: $ => parens( $, choice( $._type_head, $._type_head_params, ), ), _type_head_params: $ => choice( $._type_head_name, alias($._type_head_parens, $.parens), ), _type_head_infix: $ => prec('infix', seq( field('left_operand', $.type_param), field('operator', $._tyconops), field('right_operand', $.type_param), )), /** * A type head introduces the name and parameters in the declaration of a data type/family, type synonym/family, or * class. * * It can be in prefix or infix form: * * > A a b * > a +++ b * * Parameters can be visible or invisible, the latter marked by a prefix `@`. * They can be plain or parenthesized variable names, the latter with an optional kind signature. * They can be wildcards. * * Examples: `a`, `@a`, `(a :: Type)`, `@(_ :: Type -> Type)` * * The rules are slightly relaxed compared to GHC. */ _type_head: $ => choice( seq($._type_head_params, optional(field('patterns', $.type_params))), alias($._type_head_infix, $.infix), ), // ------------------------------------------------------------------------ // type instance head // ------------------------------------------------------------------------ _type_instance_head_parens: $ => parens( $, choice( $._type_instance_head, $._type_instance_head_params, ), optional($._kind_annotation), ), _type_instance_head_params: $ => choice( field('name', $._tycons), alias($._type_instance_head_parens, $.parens), ), type_patterns: $ => repeat1(prec('patterns', $._type_apply_arg)), /** * The equivalent of a type head, for type instances, which can contain full type patterns rather than just variable * binders. */ _type_instance_head: $ => choice( seq($._type_instance_head_params, optional(field('patterns', $.type_patterns))), seq($._cond_infix, alias($._type_infix, $.infix)), ), // ------------------------------------------------------------------------ // type decl // ------------------------------------------------------------------------ type_synomym: $ => seq( 'type', $._type_head, '=', field('type', $._ktype), ), kind_signature: $ => seq( 'type', $._type_head, $._kind_annotation, ), // ------------------------------------------------------------------------ // type instance // ------------------------------------------------------------------------ _type_instance_common: $ => seq( $._type_instance_head, '=', $.quantified_type, ), _type_instance: $ => seq( forall($), $._type_instance_common, ), type_instance: $ => seq( 'type', 'instance', $._type_instance, ), // ------------------------------------------------------------------------ // type family // ------------------------------------------------------------------------ type_family_result: $ => seq('=', field('result', $.quantified_type)), type_family_injectivity: $ => seq( $._bar, field('result', $.variable), $._arrow, field('determined', repeat1($.variable)), ), _tyfam_inj: $ => seq( $.type_family_result, optional($.type_family_injectivity), ), _tyfam: $ => seq( $._type_head, optional(choice($._kind_annotation, $._tyfam_inj)), ), _tyfam_equations: $ => layout($, field('equation', alias($._type_instance, $.equation))), /** * This syntax is valid in `.hs-boot` files. */ abstract_family: $ => layout_single($, '..'), type_family: $ => seq( 'type', 'family', $._tyfam, optional_where($, field('closed_family', choice( alias($._tyfam_equations, $.equations), $.abstract_family, ))), ), // ------------------------------------------------------------------------ // role // ------------------------------------------------------------------------ type_role: _ => choice( 'representational', 'nominal', 'phantom', '_', ), role_annotation: $ => seq( 'type', 'role', field('type', $._tycons), repeat1(field('role', $.type_role)), ) } ================================================ FILE: grammar/util.js ================================================ // ------------------------------------------------------------------------ // structure // ------------------------------------------------------------------------ const sep1 = (s, rule) => seq(rule, repeat(seq(s, rule))) const sep2 = (s, rule) => seq(rule, repeat1(seq(s, rule))) const sep = (s, rule) => optional(sep1(s, rule)) // ------------------------------------------------------------------------ // syntax // ------------------------------------------------------------------------ const parens = ($, ...rule) => seq($._paren_open, ...rule, $._paren_close) const braces = ($, ...rule) => seq('{', $._cmd_brace_open, ...rule, '}', $._cmd_brace_close) const brackets = ($, ...rule) => seq($._bracket_open, ...rule, $._bracket_close) const ticked = (...rule) => seq('`', ...rule, '`') const promoted = (...rule) => seq('\'', ...rule) const prefix_at = ($, ...rule) => prec('prefix', seq($._prefix_at, ...rule)) const semi = $ => choice(repeat1(';'), $._cond_layout_semicolon) const semi_opt = $ => optional(semi($)) const semis = ($, rule) => sep1(semi($), rule) // ------------------------------------------------------------------------ // layout // ------------------------------------------------------------------------ /** * More general variant of `layout_sort`. */ const layout_sort_single = ($, start, rule) => seq( choice(start, alias($._cmd_layout_start_explicit, '{')), rule, $._layout_end, ) /** * Wrap a repeated rule in a layout. * This is used for `where`, `let`, `of`, `if` and `do`, and the toplevel module. * The `start` rule must be one of the externals starting with `_cmd_layout_`, which instruct the scanner to push * a layout context with the current column as its indentation. * When a `_cond_layout_end` or `_cond_layout_semicolon` is encountered by the scanner, the recorded indent is compared * to the current one to make a decision. */ const layout_sort = ($, start, rule) => seq( choice(start, alias($._cmd_layout_start_explicit, '{')), optional(seq( semi_opt($), semis($, rule), semi_opt($), )), $._layout_end, ) /** * Same as `layout`, but using `layout_sort_single`. * This is necessary for braces without repeating layout elements. * Usually it is enough to just use `braces` for this (e.g. records), but if the rule is in a choice with a full * layout, we need to allow the layout start token since the scanner emits that unconditionally based on preceding * tokens. */ const layout_single = ($, rule) => layout_sort_single($, $._cmd_layout_start, rule) /** * Alias for `layout_sort` using the common layout type for the start token, which corresponds to declarations and GADT * constructors. */ const layout = ($, rule) => layout_sort($, $._cmd_layout_start, rule) // ------------------------------------------------------------------------ // unboxed // ------------------------------------------------------------------------ const unboxed = ($, ...rules) => seq($._unboxed_open, ...rules, $._unboxed_close) /** * At least one element is filled, for expressions. */ const unboxed_tuple_nonempty = ($, rule) => unboxed( $, repeat(','), field('element', rule), repeat(seq(',', optional(field('element', rule)))) ) /** * All elements are filled in, for types and patterns. */ const unboxed_tuple_full = ($, rule) => unboxed($, sep1(',', field('element', rule))) /** * Exactly one element is filled in, used by expressions, patterns and the special data constructors. */ const unboxed_sum_single = ($, rule) => unboxed( $, choice( seq(repeat1($._unboxed_bar), field('element', rule)), seq(field('element', rule), $._unboxed_bar) ), repeat($._unboxed_bar), ) /** * All elements are filled in, for types. */ const unboxed_sum_full = ($, rule) => unboxed($, sep2($._unboxed_bar, field('element', rule))) // ------------------------------------------------------------------------ // where // ------------------------------------------------------------------------ const optional_where = ($, rule) => optional(seq($._where, optional(rule))) // ------------------------------------------------------------------------ // misc // ------------------------------------------------------------------------ const qualified = ($, id) => prec('qualified-id', seq( field('module', alias($._qualifying_module, $.module)), field('id', id), )) const context = $ => optional(field('context', $.context)) const forall = $ => optional(field('forall', $._forall)) module.exports = { sep1, sep2, sep, parens, braces, brackets, ticked, promoted, prefix_at, semi, semi_opt, semis, layout_sort_single, layout_sort, layout_single, layout, unboxed, unboxed_tuple_nonempty, unboxed_tuple_full, unboxed_sum_single, unboxed_sum_full, optional_where, qualified, context, forall, } ================================================ FILE: grammar.js ================================================ const class_ = require('./grammar/class.js'), conflicts = require('./grammar/conflicts.js'), context = require('./grammar/context.js'), data = require('./grammar/data.js'), decl = require('./grammar/decl.js'), exp = require('./grammar/exp.js'), externals = require('./grammar/externals.js'), general = require('./grammar/general.js'), id = require('./grammar/id.js'), inline = require('./grammar/inline.js'), lexeme = require('./grammar/lexeme.js'), literal = require('./grammar/literal.js'), module_ = require('./grammar/module.js'), operator = require('./grammar/operator.js'), pat = require('./grammar/pat.js'), patsyn = require('./grammar/patsyn.js'), precedences = require('./grammar/precedences.js'), th = require('./grammar/th.js'), type = require('./grammar/type.js') module.exports = grammar({ name: 'haskell', rules: { haskell: $ => seq( optional($.header), optional($._body), ), ...general, ...type, ...context, ...exp, ...pat, ...module_, ...data, ...class_, ...decl, ...patsyn, ...th, ...literal, ...id, ...operator, ...lexeme, }, ...externals, ...precedences, ...inline, ...conflicts, /** * These rules may occur anywhere in the grammar and don't have to be specified in productions. */ extras: $ => [ /\p{Zs}/, /\n/, /\r/, $.cpp, $.comment, $.haddock, $.pragma, ], /** * Rules with leading underscore are generally omitted from the AST, and can therefore not be used in queries. * The rules listed in this attribute are omitted from the AST, but their names can be used in queries in place of * their children; as well as in combination with them, using the syntax `expression/variable`. * This is most useful for choice rules that represent syntactic categories, like expressions, patterns, and types in * Haskell. * * See the readme for a detailed explanation. */ supertypes: $ => [ $.expression, $.pattern, $.type, $.quantified_type, $.constraint, $.constraints, $.type_param, $.declaration, $.decl, $.class_decl, $.instance_decl, $.statement, $.qualifier, $.guard, ], /** * This rule is used to detect that a reserved keyword is a prefix of an identifier. * * For example, if the identifier `ifM` occurs in a position where the keyword `if` is valid (so most expressions), * the fact that `ifM` matches `variable` prevents tree-sitter from lexing `if` followed by `M` as a `name`. */ word: $ => $.variable, }) ================================================ FILE: package.json ================================================ { "name": "tree-sitter-haskell", "version": "0.23.1", "description": "Haskell grammar for tree-sitter", "repository": "https://github.com/tree-sitter/tree-sitter-haskell", "license": "MIT", "author": { "name": "Rick Winfrey" }, "contributors": [ { "name": "Max Brunsfeld", "email": "maxbrunsfeld@gmail.com" }, { "name": "Owen Shepherd" }, { "name": "Torsten Schmits" } ], "main": "bindings/node", "types": "bindings/node", "keywords": [ "incremental", "parsing", "tree-sitter", "haskell" ], "files": [ "grammar.js", "grammar/*.js", "tree-sitter.json", "binding.gyp", "prebuilds/**", "bindings/node/*", "queries/*", "src/**", "*.wasm" ], "dependencies": { "node-addon-api": "^8.2.2", "node-gyp-build": "^4.8.2" }, "devDependencies": { "prebuildify": "^6.0.1", "tree-sitter-cli": "^0.24.4" }, "peerDependencies": { "tree-sitter": "^0.21.1" }, "peerDependenciesMeta": { "tree-sitter": { "optional": true } }, "scripts": { "install": "node-gyp-build", "prestart": "tree-sitter build --wasm", "start": "tree-sitter playground", "test": "node --test bindings/node/*_test.js" } } ================================================ FILE: pyproject.toml ================================================ [build-system] requires = ["setuptools>=42", "wheel"] build-backend = "setuptools.build_meta" [project] name = "tree-sitter-haskell" description = "Haskell grammar for tree-sitter" version = "0.23.1" keywords = ["incremental", "parsing", "tree-sitter", "haskell"] classifiers = [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Topic :: Software Development :: Compilers", "Topic :: Text Processing :: Linguistic", "Typing :: Typed", ] requires-python = ">=3.9" license.text = "MIT" readme = "README.md" [[project.authors]] name = "Rick Winfrey" [[project.maintainers]] name = "Torsten Schmits" [project.urls] Homepage = "https://github.com/tree-sitter/tree-sitter-haskell" [project.optional-dependencies] core = ["tree-sitter~=0.22"] [tool.cibuildwheel] build = "cp39-*" build-frontend = "build" ================================================ FILE: queries/highlights.scm ================================================ ; ---------------------------------------------------------------------------- ; Parameters and variables ; NOTE: These are at the top, so that they have low priority, ; and don't override destructured parameters (variable) @variable (pattern/wildcard) @variable (decl/function patterns: (patterns (_) @variable.parameter)) (expression/lambda (_)+ @variable.parameter "->") (decl/function (infix (pattern) @variable.parameter)) ; ---------------------------------------------------------------------------- ; Literals and comments (integer) @number (negation) @number (expression/literal (float)) @number.float (char) @character (string) @string (unit) @string.special.symbol ; unit, as in () (comment) @comment ((haddock) @comment.documentation) ; ---------------------------------------------------------------------------- ; Punctuation [ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket [ "," ";" ] @punctuation.delimiter ; ---------------------------------------------------------------------------- ; Keywords, operators, includes [ "forall" ; "∀" ; utf-8 is not cross-platform safe ] @keyword.repeat (pragma) @keyword.directive [ "if" "then" "else" "case" "of" ] @keyword.conditional [ "import" "qualified" "module" ] @keyword.import [ (operator) (constructor_operator) (all_names) (wildcard) "." ".." "=" "|" "::" "=>" "->" "<-" "\\" "`" "@" ] @operator ; TODO broken, also huh? ; ((qualified_module ; (module) @constructor) ; . ; (module)) (module (module_id) @module) [ "where" "let" "in" "class" "instance" "pattern" "data" "newtype" "family" "type" "as" "hiding" "deriving" "via" "stock" "anyclass" "do" "mdo" "rec" "infix" "infixl" "infixr" ] @keyword ; ---------------------------------------------------------------------------- ; Functions and variables (decl [ name: (variable) @function names: (binding_list (variable) @function) ]) (decl/bind name: (variable) @variable) ; Consider signatures (and accompanying functions) ; with only one value on the rhs as variables (decl/signature name: (variable) @variable type: (type)) ((decl/signature name: (variable) @_name type: (type)) . (decl name: (variable) @variable) match: (_) (#eq? @_name @variable)) ; but consider a type that involves 'IO' a decl/function (decl/signature name: (variable) @function type: (type/apply constructor: (name) @_type) (#eq? @_type "IO")) ((decl/signature name: (variable) @_name type: (type/apply constructor: (name) @_type) (#eq? @_type "IO")) . (decl name: (variable) @function) match: (_) (#eq? @_name @function)) ((decl/signature) @function . (decl/function name: (variable) @function)) (decl/bind name: (variable) @function (match expression: (expression/lambda))) ; view patterns (view_pattern [ (expression/variable) @function.call (expression/qualified (variable) @function.call) ]) ; consider infix functions as operators (infix_id [ (variable) @operator (qualified (variable) @operator) ]) ; decl/function calls with an infix operator ; e.g. func <$> a <*> b (infix [ (variable) @function.call (qualified ((module) @module (variable) @function.call)) ] . (operator)) ; infix operators applied to variables ((expression/variable) @variable . (operator)) ((operator) . [ (expression/variable) @variable (expression/qualified (variable) @variable) ]) ; decl/function calls with infix operators ([ (expression/variable) @function.call (expression/qualified (variable) @function.call) ] . (operator) @_op (#any-of? @_op "$" "<$>" ">>=" "=<<")) ; right hand side of infix operator ((infix [ (operator) (infix_id (variable)) ] ; infix or `func` . [ (variable) @function.call (qualified (variable) @function.call) ]) . (operator) @_op (#any-of? @_op "$" "<$>" "=<<")) ; decl/function composition, arrows, monadic composition (lhs) ( [ (expression/variable) @function (expression/qualified (variable) @function) ] . (operator) @_op (#any-of? @_op "." ">>>" "***" ">=>" "<=<")) ; right hand side of infix operator ((infix [ (operator) (infix_id (variable)) ] ; infix or `func` . [ (variable) @function (qualified (variable) @function) ]) . (operator) @_op (#any-of? @_op "." ">>>" "***" ">=>" "<=<")) ; function composition, arrows, monadic composition (rhs) ((operator) @_op . [ (expression/variable) @function (expression/qualified (variable) @function) ] (#any-of? @_op "." ">>>" "***" ">=>" "<=<")) ; function defined in terms of a function composition (decl/function name: (variable) @function (match expression: (infix operator: (operator) @_op (#any-of? @_op "." ">>>" "***" ">=>" "<=<")))) (apply [ (expression/variable) @function.call (expression/qualified (variable) @function.call) ]) ; function compositions, in parentheses, applied ; lhs (apply . (expression/parens (infix [ (variable) @function.call (qualified (variable) @function.call) ] . (operator)))) ; rhs (apply . (expression/parens (infix (operator) . [ (variable) @function.call (qualified (variable) @function.call) ]))) ; variables being passed to a function call (apply (_) . [ (expression/variable) @variable (expression/qualified (variable) @variable) ]) ; main is always a function ; (this prevents `main = undefined` from being highlighted as a variable) (decl/bind name: (variable) @function (#eq? @function "main")) ; scoped function types (func :: a -> b) (signature pattern: (pattern/variable) @function type: (quantified_type)) ; signatures that have a function type ; + binds that follow them (decl/signature name: (variable) @function type: (quantified_type)) ((decl/signature name: (variable) @_name type: (quantified_type)) . (decl/bind (variable) @function) (#eq? @function @_name)) ; ---------------------------------------------------------------------------- ; Types (name) @type (type/star) @type (variable) @type (constructor) @constructor ; True or False ((constructor) @boolean (#any-of? @boolean "True" "False")) ; otherwise (= True) ((variable) @boolean (#eq? @boolean "otherwise")) ; ---------------------------------------------------------------------------- ; Quasi-quotes (quoter) @function.call (quasiquote [ (quoter) @_name (_ (variable) @_name) ] (#eq? @_name "qq") (quasiquote_body) @string) (quasiquote (_ (variable) @_name) (#eq? @_name "qq") (quasiquote_body) @string) ; namespaced quasi-quoter (quasiquote (_ (module) @module . (variable) @function.call)) ; Highlighting of quasiquote_body for other languages is handled by injections.scm ; ---------------------------------------------------------------------------- ; Exceptions/error handling ((variable) @keyword.exception (#any-of? @keyword.exception "error" "undefined" "try" "tryJust" "tryAny" "catch" "catches" "catchJust" "handle" "handleJust" "throw" "throwIO" "throwTo" "throwError" "ioError" "mask" "mask_" "uninterruptibleMask" "uninterruptibleMask_" "bracket" "bracket_" "bracketOnErrorSource" "finally" "fail" "onException" "expectationFailure")) ; ---------------------------------------------------------------------------- ; Debugging ((variable) @keyword.debug (#any-of? @keyword.debug "trace" "traceId" "traceShow" "traceShowId" "traceWith" "traceShowWith" "traceStack" "traceIO" "traceM" "traceShowM" "traceEvent" "traceEventWith" "traceEventIO" "flushEventLog" "traceMarker" "traceMarkerIO")) ; ---------------------------------------------------------------------------- ; Fields (field_name (variable) @variable.member) (import_name (name) . (children (variable) @variable.member)) ; ---------------------------------------------------------------------------- ; Spell checking (comment) @spell ================================================ FILE: queries/injections.scm ================================================ ; ----------------------------------------------------------------------------- ; General language injection (quasiquote (quoter) @injection.language (quasiquote_body) @injection.content) ((comment) @injection.content (#set! injection.language "comment")) ; ----------------------------------------------------------------------------- ; shakespeare library ; NOTE: doesn't support templating ; TODO: add once CoffeeScript parser is added ; ; CoffeeScript: Text.Coffee ; (quasiquote ; (quoter) @_name ; (#eq? @_name "coffee") ; ((quasiquote_body) @injection.content ; (#set! injection.language "coffeescript"))) ; CSS: Text.Cassius, Text.Lucius (quasiquote (quoter) @_name (#any-of? @_name "cassius" "lucius") (quasiquote_body) @injection.content (#set! injection.language "css")) ; HTML: Text.Hamlet (quasiquote (quoter) @_name (#any-of? @_name "shamlet" "xshamlet" "hamlet" "xhamlet" "ihamlet") (quasiquote_body) @injection.content (#set! injection.language "html")) ; JS: Text.Julius (quasiquote (quoter) @_name (#any-of? @_name "js" "julius") (quasiquote_body) @injection.content (#set! injection.language "javascript")) ; TS: Text.TypeScript (quasiquote (quoter) @_name (#any-of? @_name "tsc" "tscJSX") (quasiquote_body) @injection.content (#set! injection.language "typescript")) ; ----------------------------------------------------------------------------- ; HSX (quasiquote (quoter) @_name (#eq? @_name "hsx") (quasiquote_body) @injection.content (#set! injection.language "html")) ; ----------------------------------------------------------------------------- ; Inline JSON from aeson (quasiquote (quoter) @_name (#eq? @_name "aesonQQ") (quasiquote_body) @injection.content (#set! injection.language "json")) ; ----------------------------------------------------------------------------- ; SQL ; postgresql-simple (quasiquote (quoter) @injection.language (#eq? @injection.language "sql") (quasiquote_body) @injection.content) (quasiquote (quoter) @_name (#any-of? @_name "persistUpperCase" "persistLowerCase" "persistWith") (quasiquote_body) @injection.content (#set! injection.language "haskell_persistent")) ================================================ FILE: queries/locals.scm ================================================ (signature name: (variable)) @local.definition (function name: (variable)) @local.definition (pattern/variable) @local.definition (expression/variable) @local.reference ================================================ FILE: setup.py ================================================ from os.path import isdir, join from platform import system from setuptools import Extension, find_packages, setup from setuptools.command.build import build from wheel.bdist_wheel import bdist_wheel class Build(build): def run(self): if isdir("queries"): dest = join(self.build_lib, "tree_sitter_haskell", "queries") self.copy_tree("queries", dest) super().run() class BdistWheel(bdist_wheel): def get_tag(self): python, abi, platform = super().get_tag() if python.startswith("cp"): python, abi = "cp39", "abi3" return python, abi, platform setup( packages=find_packages("bindings/python"), package_dir={"": "bindings/python"}, package_data={ "tree_sitter_haskell": ["*.pyi", "py.typed"], "tree_sitter_haskell.queries": ["*.scm"], }, ext_package="tree_sitter_haskell", ext_modules=[ Extension( name="_binding", sources=[ "bindings/python/tree_sitter_haskell/binding.c", "src/parser.c", "src/scanner.c", ], extra_compile_args=[ "-std=c11", "-fvisibility=hidden", ] if system() != "Windows" else [ "/std:c11", "/utf-8", ], define_macros=[ ("Py_LIMITED_API", "0x03090000"), ("PY_SSIZE_T_CLEAN", None), ("TREE_SITTER_HIDE_SYMBOLS", None), ], include_dirs=["src"], py_limited_api=True, ) ], cmdclass={ "build": Build, "bdist_wheel": BdistWheel }, zip_safe=False ) ================================================ FILE: src/grammar.json ================================================ { "$schema": "https://tree-sitter.github.io/tree-sitter/assets/schemas/grammar.schema.json", "name": "haskell", "word": "variable", "rules": { "haskell": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "header" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_body" }, { "type": "BLANK" } ] } ] }, "generator": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "pattern", "content": { "type": "SYMBOL", "name": "_pat" } }, { "type": "FIELD", "name": "arrow", "content": { "type": "SYMBOL", "name": "_larrow" } }, { "type": "FIELD", "name": "expression", "content": { "type": "SYMBOL", "name": "_exp" } } ] }, "_let_binds": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_cmd_layout_start_let" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_cmd_layout_start_explicit" }, "named": false, "value": "{" } ] }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "decl", "content": { "type": "SYMBOL", "name": "decl" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "FIELD", "name": "decl", "content": { "type": "SYMBOL", "name": "decl" } } ] } } ] }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] } ] }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_layout_end" } ] }, "_let": { "type": "SEQ", "members": [ { "type": "STRING", "value": "let" }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "binds", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_let_binds" }, "named": true, "value": "local_binds" } }, { "type": "BLANK" } ] } ] }, "let": { "type": "SYMBOL", "name": "_let" }, "guard": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "generator" }, "named": true, "value": "pattern_guard" }, { "type": "SYMBOL", "name": "let" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp" }, "named": true, "value": "boolean" } ] }, "guards": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "guard", "content": { "type": "SYMBOL", "name": "guard" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "FIELD", "name": "guard", "content": { "type": "SYMBOL", "name": "guard" } } ] } } ] }, "_guards": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_bar" }, { "type": "SYMBOL", "name": "_cmd_texp_start" }, { "type": "FIELD", "name": "guards", "content": { "type": "SYMBOL", "name": "guards" } } ] }, "_universal": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "splice" }, { "type": "SYMBOL", "name": "quasiquote" }, { "type": "SYMBOL", "name": "literal" }, { "type": "SYMBOL", "name": "_unit_cons" }, { "type": "SYMBOL", "name": "_tuple_cons" } ] }, "_inferred_tyvar": { "type": "SEQ", "members": [ { "type": "STRING", "value": "{" }, { "type": "SYMBOL", "name": "_cmd_brace_open" }, { "type": "SYMBOL", "name": "_ktype_param" }, { "type": "STRING", "value": "}" }, { "type": "SYMBOL", "name": "_cmd_brace_close" } ] }, "_type_param_parens": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "SYMBOL", "name": "_ktype_param" }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "_type_param_wildcard": { "type": "STRING", "value": "_" }, "_type_param_annotated": { "type": "PREC", "value": "annotated", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "type_param" }, { "type": "SYMBOL", "name": "_kind_annotation" } ] } }, "_type_param_invisible": { "type": "PREC", "value": "prefix", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_prefix_at" }, { "type": "FIELD", "name": "bind", "content": { "type": "SYMBOL", "name": "type_param" } } ] } }, "type_param": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_param_wildcard" }, "named": true, "value": "wildcard" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_param_invisible" }, "named": true, "value": "invisible" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_param_parens" }, "named": true, "value": "parens" }, { "type": "FIELD", "name": "bind", "content": { "type": "SYMBOL", "name": "variable" } } ] }, "_ktype_param": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "type_param" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_param_annotated" }, "named": true, "value": "annotated" } ] }, "type_params": { "type": "REPEAT1", "content": { "type": "PREC", "value": "patterns", "content": { "type": "SYMBOL", "name": "type_param" } } }, "quantified_variables": { "type": "REPEAT1", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "type_param" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_inferred_tyvar" }, "named": true, "value": "inferred" } ] } }, "_type_parens": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "_ktype" } }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "_type_tuple_elems": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_ktype" } }, { "type": "REPEAT1", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_ktype" } } ] } } ] }, "_type_tuple": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "SYMBOL", "name": "_type_tuple_elems" }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "_type_unboxed_tuple": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_unboxed_open" }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_ktype" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_ktype" } } ] } } ] }, { "type": "SYMBOL", "name": "_unboxed_close" } ] }, "_type_unboxed_sum": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_unboxed_open" }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_ktype" } }, { "type": "REPEAT1", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_unboxed_bar" }, { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_ktype" } } ] } } ] }, { "type": "SYMBOL", "name": "_unboxed_close" } ] }, "_type_list": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_bracket_open" }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_ktype" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_ktype" } } ] } } ] }, { "type": "SYMBOL", "name": "_bracket_close" } ] }, "_type_promoted": { "type": "SEQ", "members": [ { "type": "STRING", "value": "'" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_plist" }, "named": true, "value": "empty_list" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_tuple" }, "named": true, "value": "tuple" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_list" }, "named": true, "value": "list" }, { "type": "SYMBOL", "name": "prefix_tuple" }, { "type": "SYMBOL", "name": "unit" } ] } ] }, "_type_name": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "variable" }, { "type": "SYMBOL", "name": "_promoted_tycons" }, { "type": "PREC", "value": "type-name", "content": { "type": "SYMBOL", "name": "_tycons" } } ] }, "_type_star": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "*" }, { "type": "STRING", "value": "★" } ] }, "_type_wildcard": { "type": "STRING", "value": "_" }, "_at_type": { "type": "PREC", "value": "prefix", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_prefix_at" }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "type" } } ] } }, "_type_apply_arg": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "type" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_at_type" }, "named": true, "value": "kind_application" } ] }, "_type_apply": { "type": "PREC_LEFT", "value": "apply", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "constructor", "content": { "type": "SYMBOL", "name": "type" } }, { "type": "FIELD", "name": "argument", "content": { "type": "SYMBOL", "name": "_type_apply_arg" } } ] } }, "_type_infix": { "type": "PREC_RIGHT", "value": "infix", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "left_operand", "content": { "type": "SYMBOL", "name": "type" } }, { "type": "FIELD", "name": "operator", "content": { "type": "SYMBOL", "name": "_tyops" } }, { "type": "FIELD", "name": "right_operand", "content": { "type": "SYMBOL", "name": "type" } } ] } }, "type": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_type_name" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_star" }, "named": true, "value": "star" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_wildcard" }, "named": true, "value": "wildcard" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_parens" }, "named": true, "value": "parens" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_promoted" }, "named": true, "value": "promoted" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_list" }, "named": true, "value": "list" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_plist" }, "named": true, "value": "prefix_list" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_unboxed_tuple" }, "named": true, "value": "unboxed_tuple" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_unboxed_sum" }, "named": true, "value": "unboxed_sum" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_tuple" }, "named": true, "value": "tuple" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_infix" }, "named": true, "value": "infix" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_apply" }, "named": true, "value": "apply" }, { "type": "SYMBOL", "name": "_universal" } ] }, "_forall_keyword": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "forall" }, { "type": "STRING", "value": "∀" } ] }, "_forall_body": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "quantifier", "content": { "type": "SYMBOL", "name": "_forall_keyword" } }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "variables", "content": { "type": "SYMBOL", "name": "quantified_variables" } }, { "type": "BLANK" } ] } ] }, "forall": { "type": "PREC", "value": "qtype-single", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_forall_body" }, { "type": "STRING", "value": "." } ] } }, "forall_required": { "type": "PREC", "value": "qtype-single", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_forall_body" }, { "type": "SYMBOL", "name": "_arrow" } ] } }, "_forall": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "forall" }, { "type": "SYMBOL", "name": "forall_required" } ] }, "_qtype_forall": { "type": "PREC_RIGHT", "value": "qtype-curried", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_forall_body" }, { "type": "STRING", "value": "." }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "quantified_type" } } ] } }, "_qtype_forall_required": { "type": "PREC_RIGHT", "value": "qtype-curried", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_forall_body" }, { "type": "SYMBOL", "name": "_arrow" }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "quantified_type" } } ] } }, "_fun_arrow": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_phantom_arrow" }, { "type": "BLANK" } ] }, { "type": "FIELD", "name": "arrow", "content": { "type": "SYMBOL", "name": "_arrow" } } ] }, "modifier": { "type": "PREC", "value": "prefix", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_prefix_percent" }, { "type": "SYMBOL", "name": "type" } ] } }, "_linear_fun_arrow": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "FIELD", "name": "multiplicity", "content": { "type": "SYMBOL", "name": "modifier" } }, { "type": "SYMBOL", "name": "_fun_arrow" } ] }, { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_phantom_arrow" }, { "type": "BLANK" } ] }, { "type": "FIELD", "name": "arrow", "content": { "type": "SYMBOL", "name": "_linear_arrow" } } ] } ] }, "strict_field": { "type": "PREC", "value": "prefix", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_any_prefix_bang" }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "type" } } ] } }, "lazy_field": { "type": "PREC", "value": "prefix", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_any_prefix_tilde" }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "type" } } ] } }, "_parameter_type": { "type": "FIELD", "name": "parameter", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "strict_field" }, { "type": "SYMBOL", "name": "lazy_field" }, { "type": "SYMBOL", "name": "quantified_type" } ] } }, "_qtype_function": { "type": "PREC_RIGHT", "value": 0, "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_parameter_type" }, { "type": "SYMBOL", "name": "_fun_arrow" }, { "type": "FIELD", "name": "result", "content": { "type": "SYMBOL", "name": "quantified_type" } } ] } }, "_qtype_linear_function": { "type": "PREC_RIGHT", "value": 0, "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_parameter_type" }, { "type": "SYMBOL", "name": "_linear_fun_arrow" }, { "type": "FIELD", "name": "result", "content": { "type": "SYMBOL", "name": "quantified_type" } } ] } }, "_qtype_context": { "type": "PREC_RIGHT", "value": "qtype-curried", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_context_inline" }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "quantified_type" } } ] } }, "quantified_type": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qtype_function" }, "named": true, "value": "function" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qtype_linear_function" }, "named": true, "value": "linear_function" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qtype_forall" }, "named": true, "value": "forall" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qtype_forall_required" }, "named": true, "value": "forall_required" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qtype_context" }, "named": true, "value": "context" }, { "type": "SYMBOL", "name": "implicit_parameter" }, { "type": "PREC_RIGHT", "value": 0, "content": { "type": "SYMBOL", "name": "type" } } ] }, "_type_annotation": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_colon2" }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "quantified_type" } } ] }, "_kind_annotation": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_colon2" }, { "type": "FIELD", "name": "kind", "content": { "type": "SYMBOL", "name": "quantified_type" } } ] }, "_type_signature": { "type": "PREC_RIGHT", "value": "annotated", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "quantified_type" } }, { "type": "SYMBOL", "name": "_kind_annotation" } ] } }, "_ktype": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_signature" }, "named": true, "value": "signature" }, { "type": "SYMBOL", "name": "quantified_type" } ] }, "_type_head_name": { "type": "FIELD", "name": "name", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_tycon" }, { "type": "SYMBOL", "name": "unit" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_plist" }, "named": true, "value": "prefix_list" } ] } }, "_type_head_parens": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_type_head" }, { "type": "SYMBOL", "name": "_type_head_params" } ] }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "_type_head_params": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_type_head_name" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_head_parens" }, "named": true, "value": "parens" } ] }, "_type_head_infix": { "type": "PREC", "value": "infix", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "left_operand", "content": { "type": "SYMBOL", "name": "type_param" } }, { "type": "FIELD", "name": "operator", "content": { "type": "SYMBOL", "name": "_tyconops" } }, { "type": "FIELD", "name": "right_operand", "content": { "type": "SYMBOL", "name": "type_param" } } ] } }, "_type_head": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_type_head_params" }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "patterns", "content": { "type": "SYMBOL", "name": "type_params" } }, { "type": "BLANK" } ] } ] }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_head_infix" }, "named": true, "value": "infix" } ] }, "_type_instance_head_parens": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_type_instance_head" }, { "type": "SYMBOL", "name": "_type_instance_head_params" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_kind_annotation" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "_type_instance_head_params": { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "_tycons" } }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_instance_head_parens" }, "named": true, "value": "parens" } ] }, "type_patterns": { "type": "REPEAT1", "content": { "type": "PREC", "value": "patterns", "content": { "type": "SYMBOL", "name": "_type_apply_arg" } } }, "_type_instance_head": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_type_instance_head_params" }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "patterns", "content": { "type": "SYMBOL", "name": "type_patterns" } }, { "type": "BLANK" } ] } ] }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_infix" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_infix" }, "named": true, "value": "infix" } ] } ] }, "type_synomym": { "type": "SEQ", "members": [ { "type": "STRING", "value": "type" }, { "type": "SYMBOL", "name": "_type_head" }, { "type": "STRING", "value": "=" }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "_ktype" } } ] }, "kind_signature": { "type": "SEQ", "members": [ { "type": "STRING", "value": "type" }, { "type": "SYMBOL", "name": "_type_head" }, { "type": "SYMBOL", "name": "_kind_annotation" } ] }, "_type_instance_common": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_type_instance_head" }, { "type": "STRING", "value": "=" }, { "type": "SYMBOL", "name": "quantified_type" } ] }, "_type_instance": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "forall", "content": { "type": "SYMBOL", "name": "_forall" } }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_type_instance_common" } ] }, "type_instance": { "type": "SEQ", "members": [ { "type": "STRING", "value": "type" }, { "type": "STRING", "value": "instance" }, { "type": "SYMBOL", "name": "_type_instance" } ] }, "type_family_result": { "type": "SEQ", "members": [ { "type": "STRING", "value": "=" }, { "type": "FIELD", "name": "result", "content": { "type": "SYMBOL", "name": "quantified_type" } } ] }, "type_family_injectivity": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_bar" }, { "type": "FIELD", "name": "result", "content": { "type": "SYMBOL", "name": "variable" } }, { "type": "SYMBOL", "name": "_arrow" }, { "type": "FIELD", "name": "determined", "content": { "type": "REPEAT1", "content": { "type": "SYMBOL", "name": "variable" } } } ] }, "_tyfam_inj": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "type_family_result" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "type_family_injectivity" }, { "type": "BLANK" } ] } ] }, "_tyfam": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_type_head" }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_kind_annotation" }, { "type": "SYMBOL", "name": "_tyfam_inj" } ] }, { "type": "BLANK" } ] } ] }, "_tyfam_equations": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_cmd_layout_start" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_cmd_layout_start_explicit" }, "named": false, "value": "{" } ] }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "equation", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_instance" }, "named": true, "value": "equation" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "FIELD", "name": "equation", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_instance" }, "named": true, "value": "equation" } } ] } } ] }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] } ] }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_layout_end" } ] }, "abstract_family": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_cmd_layout_start" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_cmd_layout_start_explicit" }, "named": false, "value": "{" } ] }, { "type": "STRING", "value": ".." }, { "type": "SYMBOL", "name": "_layout_end" } ] }, "type_family": { "type": "SEQ", "members": [ { "type": "STRING", "value": "type" }, { "type": "STRING", "value": "family" }, { "type": "SYMBOL", "name": "_tyfam" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_where" }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "closed_family", "content": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_tyfam_equations" }, "named": true, "value": "equations" }, { "type": "SYMBOL", "name": "abstract_family" } ] } }, { "type": "BLANK" } ] } ] }, { "type": "BLANK" } ] } ] }, "type_role": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "representational" }, { "type": "STRING", "value": "nominal" }, { "type": "STRING", "value": "phantom" }, { "type": "STRING", "value": "_" } ] }, "role_annotation": { "type": "SEQ", "members": [ { "type": "STRING", "value": "type" }, { "type": "STRING", "value": "role" }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "_tycons" } }, { "type": "REPEAT1", "content": { "type": "FIELD", "name": "role", "content": { "type": "SYMBOL", "name": "type_role" } } } ] }, "_class_apply": { "type": "PREC_LEFT", "value": "apply", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "constructor", "content": { "type": "SYMBOL", "name": "constraint" } }, { "type": "FIELD", "name": "argument", "content": { "type": "SYMBOL", "name": "_type_apply_arg" } } ] } }, "_class_infix": { "type": "PREC_RIGHT", "value": "infix", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_infix" }, { "type": "FIELD", "name": "left_operand", "content": { "type": "SYMBOL", "name": "type" } }, { "type": "FIELD", "name": "operator", "content": { "type": "SYMBOL", "name": "_tyops" } }, { "type": "FIELD", "name": "right_operand", "content": { "type": "SYMBOL", "name": "type" } } ] } }, "_ctr_parens": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "SYMBOL", "name": "constraints" }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "_ctr_tuple": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "constraints" }, { "type": "REPEAT1", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "SYMBOL", "name": "constraints" } ] } } ] }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "implicit_parameter": { "type": "PREC_LEFT", "value": 0, "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "implicit_variable" } }, { "type": "SYMBOL", "name": "_type_annotation" } ] } }, "constraint": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_type_name" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_class_infix" }, "named": true, "value": "infix" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_class_apply" }, "named": true, "value": "apply" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_ctr_parens" }, "named": true, "value": "parens" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_ctr_tuple" }, "named": true, "value": "tuple" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_wildcard" }, "named": true, "value": "wildcard" }, { "type": "SYMBOL", "name": "_universal" } ] }, "_ctr_forall": { "type": "PREC", "value": "fun", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_forall_body" }, { "type": "STRING", "value": "." }, { "type": "FIELD", "name": "constraint", "content": { "type": "SYMBOL", "name": "constraints" } } ] } }, "_ctr_context": { "type": "PREC", "value": "fun", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_context_inline" }, { "type": "FIELD", "name": "constraint", "content": { "type": "SYMBOL", "name": "constraints" } } ] } }, "_ctr_signature": { "type": "PREC", "value": "annotated", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "constraint", "content": { "type": "SYMBOL", "name": "constraints" } }, { "type": "SYMBOL", "name": "_kind_annotation" } ] } }, "constraints": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "constraint" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_ctr_context" }, "named": true, "value": "context" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_ctr_forall" }, "named": true, "value": "forall" }, { "type": "SYMBOL", "name": "implicit_parameter" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_ctr_signature" }, "named": true, "value": "signature" } ] }, "_context_inline": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_context" }, { "type": "FIELD", "name": "context", "content": { "type": "SYMBOL", "name": "constraint" } }, { "type": "FIELD", "name": "arrow", "content": { "type": "SYMBOL", "name": "_carrow" } } ] }, "context": { "type": "PREC", "value": "qtype-single", "content": { "type": "SYMBOL", "name": "_context_inline" } }, "_exp_name": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_cons" }, { "type": "SYMBOL", "name": "_vars" }, { "type": "SYMBOL", "name": "variable" }, { "type": "SYMBOL", "name": "implicit_variable" }, { "type": "SYMBOL", "name": "label" } ] }, "_exp_th_quoted_name": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "'" }, { "type": "FIELD", "name": "name", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_vars" }, { "type": "SYMBOL", "name": "_cons" } ] } } ] }, { "type": "PREC", "value": "prefix", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "''" }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "type" } } ] } } ] }, "_exp_parens": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "FIELD", "name": "expression", "content": { "type": "SYMBOL", "name": "_exp" } }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "_exp_tuple_elems": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": "," } }, { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_exp" } } ] }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_exp" } }, { "type": "STRING", "value": "," }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_exp" } }, { "type": "BLANK" } ] } ] } ] }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_exp" } }, { "type": "BLANK" } ] } ] } } ] }, "_exp_tuple": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "SYMBOL", "name": "_exp_tuple_elems" }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "_exp_unboxed_tuple": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_unboxed_open" }, { "type": "REPEAT", "content": { "type": "STRING", "value": "," } }, { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_exp" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_exp" } }, { "type": "BLANK" } ] } ] } }, { "type": "SYMBOL", "name": "_unboxed_close" } ] }, "_exp_unboxed_sum": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_unboxed_open" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "REPEAT1", "content": { "type": "SYMBOL", "name": "_unboxed_bar" } }, { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_exp" } } ] }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_exp" } }, { "type": "SYMBOL", "name": "_unboxed_bar" } ] } ] }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_unboxed_bar" } }, { "type": "SYMBOL", "name": "_unboxed_close" } ] }, "_exp_list": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_bracket_open" }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_exp" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_exp" } } ] } } ] }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "," }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_bracket_close" } ] }, "_exp_arithmetic_sequence": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_bracket_open" }, { "type": "FIELD", "name": "from", "content": { "type": "SYMBOL", "name": "_exp" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "FIELD", "name": "step", "content": { "type": "SYMBOL", "name": "_exp" } } ] }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_dotdot" }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "to", "content": { "type": "SYMBOL", "name": "_exp" } }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_bracket_close" } ] }, "group": { "type": "SEQ", "members": [ { "type": "STRING", "value": "then" }, { "type": "STRING", "value": "group" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "by" }, { "type": "FIELD", "name": "key", "content": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_signature" }, "named": true, "value": "signature" }, { "type": "SYMBOL", "name": "expression" } ] } } ] }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "using" }, { "type": "FIELD", "name": "classifier", "content": { "type": "SYMBOL", "name": "_exp" } } ] }, "transform": { "type": "SEQ", "members": [ { "type": "STRING", "value": "then" }, { "type": "FIELD", "name": "transformation", "content": { "type": "SYMBOL", "name": "_exp" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "by" }, { "type": "FIELD", "name": "key", "content": { "type": "SYMBOL", "name": "_exp" } } ] }, { "type": "BLANK" } ] } ] }, "qualifier": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "generator" }, { "type": "SYMBOL", "name": "let" }, { "type": "SYMBOL", "name": "transform" }, { "type": "SYMBOL", "name": "group" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp" }, "named": true, "value": "boolean" } ] }, "qualifiers": { "type": "SEQ", "members": [ { "type": "SEQ", "members": [ { "type": "FIELD", "name": "qualifier", "content": { "type": "SYMBOL", "name": "qualifier" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "FIELD", "name": "qualifier", "content": { "type": "SYMBOL", "name": "qualifier" } } ] } } ] } ] }, "_exp_list_comprehension": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_bracket_open" }, { "type": "FIELD", "name": "expression", "content": { "type": "SYMBOL", "name": "_exp" } }, { "type": "REPEAT1", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "|" }, { "type": "FIELD", "name": "qualifiers", "content": { "type": "SYMBOL", "name": "qualifiers" } } ] } }, { "type": "SYMBOL", "name": "_bracket_close" } ] }, "_exp_lambda": { "type": "SEQ", "members": [ { "type": "STRING", "value": "\\" }, { "type": "FIELD", "name": "patterns", "content": { "type": "SYMBOL", "name": "patterns" } }, { "type": "SYMBOL", "name": "_arrow" }, { "type": "FIELD", "name": "expression", "content": { "type": "SYMBOL", "name": "_exp" } } ] }, "_exp_let_in": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_let" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_phantom_in" }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "in" }, { "type": "FIELD", "name": "expression", "content": { "type": "SYMBOL", "name": "_exp" } } ] }, "_exp_conditional": { "type": "SEQ", "members": [ { "type": "STRING", "value": "if" }, { "type": "FIELD", "name": "if", "content": { "type": "SYMBOL", "name": "_exp" } }, { "type": "REPEAT", "content": { "type": "STRING", "value": ";" } }, { "type": "STRING", "value": "then" }, { "type": "FIELD", "name": "then", "content": { "type": "SYMBOL", "name": "_exp" } }, { "type": "REPEAT", "content": { "type": "STRING", "value": ";" } }, { "type": "STRING", "value": "else" }, { "type": "FIELD", "name": "else", "content": { "type": "SYMBOL", "name": "_exp" } } ] }, "_exp_greedy": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_lambda" }, "named": true, "value": "lambda" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_let_in" }, "named": true, "value": "let_in" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_conditional" }, "named": true, "value": "conditional" } ] }, "_exp_statement": { "type": "SYMBOL", "name": "_exp" }, "statement": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_statement" }, "named": true, "value": "exp" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "generator" }, "named": true, "value": "bind" }, { "type": "SYMBOL", "name": "let" }, { "type": "SYMBOL", "name": "rec" } ] }, "_statements": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_cmd_layout_start_do" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_cmd_layout_start_explicit" }, "named": false, "value": "{" } ] }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "statement", "content": { "type": "SYMBOL", "name": "statement" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "FIELD", "name": "statement", "content": { "type": "SYMBOL", "name": "statement" } } ] } } ] }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] } ] }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_layout_end" } ] }, "rec": { "type": "SEQ", "members": [ { "type": "STRING", "value": "rec" }, { "type": "SYMBOL", "name": "_statements" } ] }, "_do_keyword": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "mdo" }, { "type": "STRING", "value": "do" } ] }, "do_module": { "type": "FIELD", "name": "qualified_do", "content": { "type": "PREC", "value": "qualified-id", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "module", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qualifying_module" }, "named": true, "value": "module" } }, { "type": "FIELD", "name": "id", "content": { "type": "SYMBOL", "name": "_do_keyword" } } ] } } }, "_do": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "do_module" }, { "type": "SYMBOL", "name": "_do_keyword" } ] }, "_exp_do": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_do" }, { "type": "SYMBOL", "name": "_statements" } ] }, "match": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_guards" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_phantom_arrow" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_arrow" }, { "type": "SYMBOL", "name": "_cmd_texp_end" }, { "type": "FIELD", "name": "expression", "content": { "type": "SYMBOL", "name": "_exp" } } ] }, "_simple_match": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_arrow" }, { "type": "FIELD", "name": "expression", "content": { "type": "SYMBOL", "name": "_exp" } } ] }, "_matches": { "type": "FIELD", "name": "match", "content": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_simple_match" }, "named": true, "value": "match" }, { "type": "REPEAT1", "content": { "type": "SYMBOL", "name": "match" } } ] } }, "alternative": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "pattern", "content": { "type": "SYMBOL", "name": "_pat" } }, { "type": "SYMBOL", "name": "_matches" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_where_binds" }, { "type": "BLANK" } ] } ] }, "_nalt": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "patterns", "content": { "type": "SYMBOL", "name": "patterns" } }, { "type": "SYMBOL", "name": "_matches" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_where_binds" }, { "type": "BLANK" } ] } ] }, "alternatives": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_cmd_layout_start_case" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_cmd_layout_start_explicit" }, "named": false, "value": "{" } ] }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "alternative", "content": { "type": "SYMBOL", "name": "alternative" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "FIELD", "name": "alternative", "content": { "type": "SYMBOL", "name": "alternative" } } ] } } ] }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] } ] }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_layout_end" } ] }, "_nalts": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_cmd_layout_start_case" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_cmd_layout_start_explicit" }, "named": false, "value": "{" } ] }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "alternative", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_nalt" }, "named": true, "value": "alternative" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "FIELD", "name": "alternative", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_nalt" }, "named": true, "value": "alternative" } } ] } } ] }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] } ] }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_layout_end" } ] }, "_exp_case": { "type": "SEQ", "members": [ { "type": "STRING", "value": "case" }, { "type": "SYMBOL", "name": "_exp" }, { "type": "STRING", "value": "of" }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "alternatives", "content": { "type": "SYMBOL", "name": "alternatives" } }, { "type": "BLANK" } ] } ] }, "_exp_lambda_case": { "type": "SEQ", "members": [ { "type": "STRING", "value": "\\" }, { "type": "STRING", "value": "case" }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "alternatives", "content": { "type": "SYMBOL", "name": "alternatives" } }, { "type": "BLANK" } ] } ] }, "_exp_lambda_cases": { "type": "SEQ", "members": [ { "type": "STRING", "value": "\\" }, { "type": "STRING", "value": "cases" }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "alternatives", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_nalts" }, "named": true, "value": "alternatives" } }, { "type": "BLANK" } ] } ] }, "_exp_multi_way_if": { "type": "SEQ", "members": [ { "type": "STRING", "value": "if" }, { "type": "SYMBOL", "name": "_cmd_layout_start_if" }, { "type": "REPEAT", "content": { "type": "FIELD", "name": "match", "content": { "type": "SYMBOL", "name": "match" } } }, { "type": "SYMBOL", "name": "_cond_layout_end" } ] }, "field_update": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "STRING", "value": ".." }, "named": true, "value": "wildcard" }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "field", "content": { "type": "SYMBOL", "name": "_field_spec" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "=" }, { "type": "FIELD", "name": "expression", "content": { "type": "SYMBOL", "name": "_exp" } } ] }, { "type": "BLANK" } ] } ] } ] }, "_exp_record": { "type": "PREC", "value": "record", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "expression", "content": { "type": "SYMBOL", "name": "expression" } }, { "type": "SEQ", "members": [ { "type": "STRING", "value": "{" }, { "type": "SYMBOL", "name": "_cmd_brace_open" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "FIELD", "name": "field", "content": { "type": "SYMBOL", "name": "field_update" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "FIELD", "name": "field", "content": { "type": "SYMBOL", "name": "field_update" } } ] } } ] }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "}" }, { "type": "SYMBOL", "name": "_cmd_brace_close" } ] } ] } }, "_exp_projection_selector": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "SYMBOL", "name": "_any_prefix_dot" }, { "type": "FIELD", "name": "field", "content": { "type": "SYMBOL", "name": "variable" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_tight_dot" }, { "type": "FIELD", "name": "field", "content": { "type": "SYMBOL", "name": "variable" } } ] } }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "_exp_projection": { "type": "SEQ", "members": [ { "type": "PREC", "value": "projection", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "expression", "content": { "type": "SYMBOL", "name": "expression" } }, { "type": "SYMBOL", "name": "_tight_dot" } ] } }, { "type": "FIELD", "name": "field", "content": { "type": "SYMBOL", "name": "field_name" } } ] }, "explicit_type": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "STRING", "value": "type" }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "type" } }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "_exp_apply": { "type": "PREC_LEFT", "value": "apply", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "function", "content": { "type": "SYMBOL", "name": "expression" } }, { "type": "FIELD", "name": "argument", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "expression" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_at_type" }, "named": true, "value": "type_application" }, { "type": "SYMBOL", "name": "explicit_type" } ] } } ] } }, "_exp_op": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_sym" }, { "type": "SYMBOL", "name": "_op_ticked" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_prefix_dot" }, "named": true, "value": "operator" } ] }, "_exp_section_left": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "FIELD", "name": "left_operand", "content": { "type": "SYMBOL", "name": "expression" } }, { "type": "SYMBOL", "name": "_cond_left_section_op" }, { "type": "FIELD", "name": "operator", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_exp_op" }, { "type": "SYMBOL", "name": "_operator_minus" }, { "type": "SYMBOL", "name": "_qsym" } ] } }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "_exp_section_right": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_operator_qual_dot_head" }, "named": true, "value": "operator" }, { "type": "SYMBOL", "name": "_ops" } ] }, { "type": "FIELD", "name": "right_operand", "content": { "type": "SYMBOL", "name": "expression" } }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "_exp_negation": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "minus", "content": { "type": "STRING", "value": "-" } }, { "type": "PREC", "value": "negation", "content": { "type": "FIELD", "name": "expression", "content": { "type": "SYMBOL", "name": "expression" } } } ] }, "_exp_infix": { "type": "PREC_RIGHT", "value": "infix", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "left_operand", "content": { "type": "SYMBOL", "name": "expression" } }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_cond_no_section_op" }, { "type": "BLANK" } ] }, { "type": "FIELD", "name": "operator", "content": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_minus" }, { "type": "SYMBOL", "name": "_operator_minus" } ] }, { "type": "SYMBOL", "name": "_exp_op" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_qualified_op" }, { "type": "SYMBOL", "name": "_qsym" } ] } ] } }, { "type": "FIELD", "name": "right_operand", "content": { "type": "SYMBOL", "name": "expression" } } ] } }, "expression": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_infix" }, "named": true, "value": "infix" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_negation" }, "named": true, "value": "negation" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_apply" }, "named": true, "value": "apply" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_record" }, "named": true, "value": "record" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_projection" }, "named": true, "value": "projection" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_arithmetic_sequence" }, "named": true, "value": "arithmetic_sequence" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_list_comprehension" }, "named": true, "value": "list_comprehension" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_unboxed_tuple" }, "named": true, "value": "unboxed_tuple" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_unboxed_sum" }, "named": true, "value": "unboxed_sum" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_projection_selector" }, "named": true, "value": "projection_selector" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_quote" }, "named": true, "value": "quote" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_typed_quote" }, "named": true, "value": "typed_quote" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_th_quoted_name" }, "named": true, "value": "th_quoted_name" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_lambda_case" }, "named": true, "value": "lambda_case" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_lambda_cases" }, "named": true, "value": "lambda_cases" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_do" }, "named": true, "value": "do" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_parens" }, "named": true, "value": "parens" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_tuple" }, "named": true, "value": "tuple" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_list" }, "named": true, "value": "list" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_plist" }, "named": true, "value": "list" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_section_left" }, "named": true, "value": "left_section" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_section_right" }, "named": true, "value": "right_section" }, { "type": "SYMBOL", "name": "_exp_greedy" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_case" }, "named": true, "value": "case" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_multi_way_if" }, "named": true, "value": "multi_way_if" }, { "type": "SYMBOL", "name": "_exp_name" }, { "type": "SYMBOL", "name": "_universal" } ] }, "_exp_signature": { "type": "PREC_RIGHT", "value": "annotated", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "expression", "content": { "type": "SYMBOL", "name": "expression" } }, { "type": "SYMBOL", "name": "_type_annotation" } ] } }, "_exp": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_signature" }, "named": true, "value": "signature" }, { "type": "PREC_RIGHT", "value": 0, "content": { "type": "SYMBOL", "name": "expression" } } ] }, "_pat_parens": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "FIELD", "name": "pattern", "content": { "type": "SYMBOL", "name": "_pat_texp" } }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "_pat_tuple_elems": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_pat_texp" } }, { "type": "REPEAT1", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_pat_texp" } } ] } } ] }, "_pat_tuple": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "SYMBOL", "name": "_pat_tuple_elems" }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "_pat_unboxed_tuple": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_unboxed_open" }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_pat_texp" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_pat_texp" } } ] } } ] }, { "type": "SYMBOL", "name": "_unboxed_close" } ] }, "_pat_unboxed_sum": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_unboxed_open" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "REPEAT1", "content": { "type": "SYMBOL", "name": "_unboxed_bar" } }, { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_pat_texp" } } ] }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_pat_texp" } }, { "type": "SYMBOL", "name": "_unboxed_bar" } ] } ] }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_unboxed_bar" } }, { "type": "SYMBOL", "name": "_unboxed_close" } ] }, "_pat_list": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_bracket_open" }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_pat_texp" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_pat_texp" } } ] } } ] }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "," }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_bracket_close" } ] }, "field_pattern": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "STRING", "value": ".." }, "named": true, "value": "wildcard" }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "field", "content": { "type": "SYMBOL", "name": "_field_names" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "=" }, { "type": "FIELD", "name": "pattern", "content": { "type": "SYMBOL", "name": "_pat_texp" } } ] }, { "type": "BLANK" } ] } ] } ] }, "_pat_record": { "type": "PREC", "value": "record", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "constructor", "content": { "type": "SYMBOL", "name": "pattern" } }, { "type": "SEQ", "members": [ { "type": "STRING", "value": "{" }, { "type": "SYMBOL", "name": "_cmd_brace_open" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "FIELD", "name": "field", "content": { "type": "SYMBOL", "name": "field_pattern" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "FIELD", "name": "field", "content": { "type": "SYMBOL", "name": "field_pattern" } } ] } } ] }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "}" }, { "type": "SYMBOL", "name": "_cmd_brace_close" } ] } ] } }, "_pat_name": { "type": "CHOICE", "members": [ { "type": "PREC", "value": "pat-name", "content": { "type": "PREC_DYNAMIC", "value": -1000, "content": { "type": "SYMBOL", "name": "_var" } } }, { "type": "SYMBOL", "name": "_cons" } ] }, "_pat_as": { "type": "PREC", "value": "prefix", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "bind", "content": { "type": "SYMBOL", "name": "variable" } }, { "type": "SYMBOL", "name": "_tight_at" }, { "type": "FIELD", "name": "pattern", "content": { "type": "SYMBOL", "name": "pattern" } } ] } }, "_pat_wildcard": { "type": "STRING", "value": "_" }, "_pat_strict": { "type": "PREC", "value": "prefix", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_any_prefix_bang" }, { "type": "FIELD", "name": "pattern", "content": { "type": "SYMBOL", "name": "pattern" } } ] } }, "_pat_irrefutable": { "type": "PREC", "value": "prefix", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_any_prefix_tilde" }, { "type": "FIELD", "name": "pattern", "content": { "type": "SYMBOL", "name": "pattern" } } ] } }, "_pat_apply_arg": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "pattern" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_at_type" }, "named": true, "value": "type_binder" }, { "type": "SYMBOL", "name": "explicit_type" } ] }, "_pat_apply": { "type": "PREC_LEFT", "value": "apply", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "function", "content": { "type": "SYMBOL", "name": "pattern" } }, { "type": "FIELD", "name": "argument", "content": { "type": "SYMBOL", "name": "_pat_apply_arg" } } ] } }, "_pat_negation": { "type": "SEQ", "members": [ { "type": "STRING", "value": "-" }, { "type": "FIELD", "name": "number", "content": { "type": "SYMBOL", "name": "_number" } } ] }, "_pat_infix": { "type": "PREC_RIGHT", "value": "infix", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "left_operand", "content": { "type": "SYMBOL", "name": "pattern" } }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_cond_no_section_op" }, { "type": "BLANK" } ] }, { "type": "FIELD", "name": "operator", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "constructor_operator" }, { "type": "SYMBOL", "name": "_conids_ticked" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_qualified_op" }, { "type": "SYMBOL", "name": "_qconsym" } ] } ] } }, { "type": "FIELD", "name": "right_operand", "content": { "type": "SYMBOL", "name": "pattern" } } ] } }, "pattern": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_pat_infix" }, "named": true, "value": "infix" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_pat_negation" }, "named": true, "value": "negation" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_pat_apply" }, "named": true, "value": "apply" }, { "type": "SYMBOL", "name": "_pat_name" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_pat_as" }, "named": true, "value": "as" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_pat_record" }, "named": true, "value": "record" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_pat_wildcard" }, "named": true, "value": "wildcard" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_pat_parens" }, "named": true, "value": "parens" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_pat_tuple" }, "named": true, "value": "tuple" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_pat_unboxed_tuple" }, "named": true, "value": "unboxed_tuple" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_pat_unboxed_sum" }, "named": true, "value": "unboxed_sum" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_pat_list" }, "named": true, "value": "list" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_plist" }, "named": true, "value": "list" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_pat_strict" }, "named": true, "value": "strict" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_pat_irrefutable" }, "named": true, "value": "irrefutable" }, { "type": "SYMBOL", "name": "_universal" } ] }, "patterns": { "type": "REPEAT1", "content": { "type": "PREC", "value": "patterns", "content": { "type": "SYMBOL", "name": "_pat_apply_arg" } } }, "_pat_signature": { "type": "PREC_RIGHT", "value": "annotated", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "pattern", "content": { "type": "SYMBOL", "name": "pattern" } }, { "type": "SYMBOL", "name": "_type_annotation" } ] } }, "_pat": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_pat_signature" }, "named": true, "value": "signature" }, { "type": "PREC_RIGHT", "value": 0, "content": { "type": "SYMBOL", "name": "pattern" } } ] }, "view_pattern": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "expression", "content": { "type": "SYMBOL", "name": "_exp" } }, { "type": "SYMBOL", "name": "_arrow" }, { "type": "FIELD", "name": "pattern", "content": { "type": "SYMBOL", "name": "_pat_texp" } } ] }, "_pat_texp": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "view_pattern" }, { "type": "SYMBOL", "name": "_pat" } ] }, "_modid": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "name" }, "named": true, "value": "module_id" }, "_modid_prefix": { "type": "PREC", "value": "qualifying-module", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_modid" }, { "type": "SYMBOL", "name": "_any_tight_dot" } ] } }, "_qualifying_module": { "type": "REPEAT1", "content": { "type": "SYMBOL", "name": "_modid_prefix" } }, "module": { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_modid_prefix" } }, { "type": "SYMBOL", "name": "_modid" } ] }, "namespace": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "pattern" }, { "type": "STRING", "value": "type" } ] }, "_child_type": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "namespace", "content": { "type": "STRING", "value": "type" } }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "_tyconids" } } ] }, "_child": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_child_type" }, "named": true, "value": "associated_type" }, { "type": "SYMBOL", "name": "_qname" } ] }, "children": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "FIELD", "name": "element", "content": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "STRING", "value": ".." }, "named": true, "value": "all_names" }, { "type": "SYMBOL", "name": "_child" } ] } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "FIELD", "name": "element", "content": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "STRING", "value": ".." }, "named": true, "value": "all_names" }, { "type": "SYMBOL", "name": "_child" } ] } } ] } } ] }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "_ie_entity": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "namespace", "content": { "type": "SYMBOL", "name": "namespace" } }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "variable", "content": { "type": "SYMBOL", "name": "_varids" } }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "_tyconids" } }, { "type": "FIELD", "name": "operator", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_sym_prefix" }, { "type": "SYMBOL", "name": "_pqsym" } ] } } ] }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "children", "content": { "type": "SYMBOL", "name": "children" } }, { "type": "BLANK" } ] } ] }, "import_list": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "FIELD", "name": "name", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_ie_entity" }, "named": true, "value": "import_name" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "FIELD", "name": "name", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_ie_entity" }, "named": true, "value": "import_name" } } ] } } ] }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "," }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "import": { "type": "SEQ", "members": [ { "type": "STRING", "value": "import" }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "qualified" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "package", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "string" }, "named": true, "value": "import_package" } }, { "type": "BLANK" } ] }, { "type": "FIELD", "name": "module", "content": { "type": "SYMBOL", "name": "module" } }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "qualified" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "as" }, { "type": "FIELD", "name": "alias", "content": { "type": "SYMBOL", "name": "module" } } ] }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "STRING", "value": "hiding" }, { "type": "BLANK" } ] }, { "type": "FIELD", "name": "names", "content": { "type": "SYMBOL", "name": "import_list" } } ] }, { "type": "BLANK" } ] } ] }, "module_export": { "type": "SEQ", "members": [ { "type": "STRING", "value": "module" }, { "type": "FIELD", "name": "module", "content": { "type": "SYMBOL", "name": "module" } } ] }, "exports": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "export", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_ie_entity" }, "named": true, "value": "export" } }, { "type": "SYMBOL", "name": "module_export" } ] }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "export", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_ie_entity" }, "named": true, "value": "export" } }, { "type": "SYMBOL", "name": "module_export" } ] } ] } } ] }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "," }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "header": { "type": "SEQ", "members": [ { "type": "STRING", "value": "module" }, { "type": "FIELD", "name": "module", "content": { "type": "SYMBOL", "name": "module" } }, { "type": "FIELD", "name": "exports", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "exports" }, { "type": "BLANK" } ] } }, { "type": "SYMBOL", "name": "_where" } ] }, "imports": { "type": "SEQ", "members": [ { "type": "SEQ", "members": [ { "type": "FIELD", "name": "import", "content": { "type": "SYMBOL", "name": "import" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "FIELD", "name": "import", "content": { "type": "SYMBOL", "name": "import" } } ] } } ] }, { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] } ] }, "declarations": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "declaration" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "declaration" }, { "type": "SYMBOL", "name": "import" } ] } ] } }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] } ] }, "_body": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_cmd_layout_start" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_cmd_layout_start_explicit" }, "named": false, "value": "{" } ] }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] }, { "type": "FIELD", "name": "imports", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "imports" }, { "type": "BLANK" } ] } }, { "type": "FIELD", "name": "declarations", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "declarations" }, { "type": "BLANK" } ] } }, { "type": "SYMBOL", "name": "_layout_end" } ] }, "_layout_end": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_cond_layout_end" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_cond_layout_end_explicit" }, "named": false, "value": "}" } ] }, "declaration": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "decl" }, { "type": "SYMBOL", "name": "type_synomym" }, { "type": "SYMBOL", "name": "kind_signature" }, { "type": "SYMBOL", "name": "type_family" }, { "type": "SYMBOL", "name": "type_instance" }, { "type": "SYMBOL", "name": "role_annotation" }, { "type": "SYMBOL", "name": "data_type" }, { "type": "SYMBOL", "name": "newtype" }, { "type": "SYMBOL", "name": "data_family" }, { "type": "SYMBOL", "name": "data_instance" }, { "type": "SYMBOL", "name": "class" }, { "type": "SYMBOL", "name": "instance" }, { "type": "SYMBOL", "name": "default_types" }, { "type": "SYMBOL", "name": "deriving_instance" }, { "type": "SYMBOL", "name": "pattern_synonym" }, { "type": "SYMBOL", "name": "foreign_import" }, { "type": "SYMBOL", "name": "foreign_export" }, { "type": "SYMBOL", "name": "fixity" }, { "type": "SYMBOL", "name": "top_splice" } ] }, "field_name": { "type": "SYMBOL", "name": "variable" }, "_qfield_name": { "type": "PREC", "value": "qualified-id", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "module", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qualifying_module" }, "named": true, "value": "module" } }, { "type": "FIELD", "name": "id", "content": { "type": "SYMBOL", "name": "field_name" } } ] } }, "_field_names": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "field_name" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qfield_name" }, "named": true, "value": "qualified" } ] }, "field_path": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "field", "content": { "type": "SYMBOL", "name": "_field_names" } }, { "type": "REPEAT1", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_tight_dot" }, { "type": "FIELD", "name": "subfield", "content": { "type": "SYMBOL", "name": "field_name" } } ] } } ] }, "_field_spec": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_field_names" }, { "type": "SYMBOL", "name": "field_path" } ] }, "field": { "type": "PREC", "value": "annotated", "content": { "type": "SEQ", "members": [ { "type": "SEQ", "members": [ { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "field_name" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "field_name" } } ] } } ] }, { "type": "SYMBOL", "name": "_colon2" }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "_parameter_type" } } ] } }, "_record_fields": { "type": "SEQ", "members": [ { "type": "STRING", "value": "{" }, { "type": "SYMBOL", "name": "_cmd_brace_open" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "FIELD", "name": "field", "content": { "type": "SYMBOL", "name": "field" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "FIELD", "name": "field", "content": { "type": "SYMBOL", "name": "field" } } ] } } ] }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "," }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "}" }, { "type": "SYMBOL", "name": "_cmd_brace_close" } ] }, "via": { "type": "SEQ", "members": [ { "type": "STRING", "value": "via" }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "quantified_type" } } ] }, "deriving_strategy": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "stock" }, { "type": "STRING", "value": "newtype" }, { "type": "STRING", "value": "anyclass" } ] }, "deriving": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_phantom_deriving" }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "deriving" }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "strategy", "content": { "type": "SYMBOL", "name": "deriving_strategy" } }, { "type": "BLANK" } ] }, { "type": "FIELD", "name": "classes", "content": { "type": "SYMBOL", "name": "constraint" } }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "via", "content": { "type": "SYMBOL", "name": "via" } }, { "type": "BLANK" } ] } ] }, "_gadt_con_prefix": { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "quantified_type" } }, "_gadt_con_record": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "fields", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_record_fields" }, "named": true, "value": "fields" } }, { "type": "FIELD", "name": "arrow", "content": { "type": "SYMBOL", "name": "_fun_arrow" } }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "quantified_type" } } ] }, "gadt_constructor": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "_con" } }, { "type": "FIELD", "name": "names", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_con_binding_list" }, "named": true, "value": "binding_list" } } ] }, { "type": "SYMBOL", "name": "_colon2" }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "forall", "content": { "type": "SYMBOL", "name": "_forall" } }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "context", "content": { "type": "SYMBOL", "name": "context" } }, { "type": "BLANK" } ] }, { "type": "FIELD", "name": "type", "content": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_gadt_con_prefix" }, "named": true, "value": "prefix" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_gadt_con_record" }, "named": true, "value": "record" } ] } } ] }, "gadt_constructors": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_cmd_layout_start" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_cmd_layout_start_explicit" }, "named": false, "value": "{" } ] }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "constructor", "content": { "type": "SYMBOL", "name": "gadt_constructor" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "FIELD", "name": "constructor", "content": { "type": "SYMBOL", "name": "gadt_constructor" } } ] } } ] }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] } ] }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_layout_end" } ] }, "_gadt": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_kind_annotation" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_where" }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "constructors", "content": { "type": "SYMBOL", "name": "gadt_constructors" } }, { "type": "BLANK" } ] } ] }, "_field_type": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "strict_field" }, { "type": "SYMBOL", "name": "lazy_field" }, { "type": "SYMBOL", "name": "type" } ] }, "_datacon_prefix": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "_con" } }, { "type": "REPEAT", "content": { "type": "PREC", "value": "patterns", "content": { "type": "FIELD", "name": "field", "content": { "type": "SYMBOL", "name": "_field_type" } } } } ] }, "_datacon_infix": { "type": "PREC", "value": "infix", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_data_infix" }, { "type": "FIELD", "name": "left_operand", "content": { "type": "SYMBOL", "name": "_field_type" } }, { "type": "FIELD", "name": "operator", "content": { "type": "SYMBOL", "name": "_conop" } }, { "type": "FIELD", "name": "right_operand", "content": { "type": "SYMBOL", "name": "_field_type" } } ] } }, "_datacon_record": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "_constructor" } }, { "type": "FIELD", "name": "fields", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_record_fields" }, "named": true, "value": "fields" } } ] }, "_datacon_unboxed_sum": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_unboxed_open" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "REPEAT1", "content": { "type": "SYMBOL", "name": "_unboxed_bar" } }, { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "quantified_type" } } ] }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "quantified_type" } }, { "type": "SYMBOL", "name": "_unboxed_bar" } ] } ] }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_unboxed_bar" } }, { "type": "SYMBOL", "name": "_unboxed_close" } ] }, "_datacon_special": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "unit" }, { "type": "SYMBOL", "name": "unboxed_unit" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_plist" }, "named": true, "value": "empty_list" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_tuple" }, "named": true, "value": "tuple" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_type_unboxed_tuple" }, "named": true, "value": "unboxed_tuple" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_datacon_unboxed_sum" }, "named": true, "value": "unboxed_sum" } ] }, "data_constructor": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "forall", "content": { "type": "SYMBOL", "name": "_forall" } }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "context", "content": { "type": "SYMBOL", "name": "context" } }, { "type": "BLANK" } ] }, { "type": "FIELD", "name": "constructor", "content": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_datacon_prefix" }, "named": true, "value": "prefix" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_datacon_infix" }, "named": true, "value": "infix" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_datacon_record" }, "named": true, "value": "record" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_datacon_special" }, "named": true, "value": "special" } ] } } ] }, "data_constructors": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "constructor", "content": { "type": "SYMBOL", "name": "data_constructor" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_bar" }, { "type": "FIELD", "name": "constructor", "content": { "type": "SYMBOL", "name": "data_constructor" } } ] } } ] }, "_data_rhs": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_kind_annotation" }, { "type": "SEQ", "members": [ { "type": "STRING", "value": "=" }, { "type": "FIELD", "name": "constructors", "content": { "type": "SYMBOL", "name": "data_constructors" } } ] }, { "type": "SYMBOL", "name": "_gadt" } ] }, "_data": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "context", "content": { "type": "SYMBOL", "name": "context" } }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_type_head" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_data_rhs" }, { "type": "BLANK" } ] }, { "type": "REPEAT", "content": { "type": "FIELD", "name": "deriving", "content": { "type": "SYMBOL", "name": "deriving" } } } ] }, "data_type": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "STRING", "value": "type" }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "data" }, { "type": "SYMBOL", "name": "_data" } ] }, "_newtype_con_field": { "type": "SYMBOL", "name": "type" }, "newtype_constructor": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "_con" } }, { "type": "FIELD", "name": "field", "content": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_newtype_con_field" }, "named": true, "value": "field" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_record_fields" }, "named": true, "value": "record" } ] } } ] }, "_newtype": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "=" }, { "type": "FIELD", "name": "constructor", "content": { "type": "SYMBOL", "name": "newtype_constructor" } } ] }, { "type": "SYMBOL", "name": "_gadt" } ] }, { "type": "REPEAT", "content": { "type": "FIELD", "name": "deriving", "content": { "type": "SYMBOL", "name": "deriving" } } } ] }, "newtype": { "type": "SEQ", "members": [ { "type": "STRING", "value": "newtype" }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "context", "content": { "type": "SYMBOL", "name": "context" } }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_type_head" }, { "type": "SYMBOL", "name": "_newtype" } ] }, "_datafam": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_type_head" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_kind_annotation" }, { "type": "BLANK" } ] } ] }, "data_family": { "type": "SEQ", "members": [ { "type": "STRING", "value": "data" }, { "type": "STRING", "value": "family" }, { "type": "SYMBOL", "name": "_datafam" } ] }, "_inst_adt": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "forall", "content": { "type": "SYMBOL", "name": "_forall" } }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "context", "content": { "type": "SYMBOL", "name": "context" } }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_type_instance_head" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_data_rhs" }, { "type": "BLANK" } ] }, { "type": "REPEAT", "content": { "type": "FIELD", "name": "deriving", "content": { "type": "SYMBOL", "name": "deriving" } } } ] }, "decl_inst_adt": { "type": "SEQ", "members": [ { "type": "STRING", "value": "data" }, { "type": "STRING", "value": "instance" }, { "type": "SYMBOL", "name": "_inst_adt" } ] }, "_inst_newtype": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "forall", "content": { "type": "SYMBOL", "name": "_forall" } }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "context", "content": { "type": "SYMBOL", "name": "context" } }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_type_instance_head" }, { "type": "SYMBOL", "name": "_newtype" } ] }, "decl_inst_newtype": { "type": "SEQ", "members": [ { "type": "STRING", "value": "newtype" }, { "type": "STRING", "value": "instance" }, { "type": "SYMBOL", "name": "_inst_newtype" } ] }, "data_instance": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "decl_inst_adt" }, "named": true, "value": "data_type" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "decl_inst_newtype" }, "named": true, "value": "newtype" } ] }, "_assoc_tyfam": { "type": "SEQ", "members": [ { "type": "STRING", "value": "type" }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "family" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_type_head" }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_kind_annotation" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "type_family_result" }, { "type": "SYMBOL", "name": "type_family_injectivity" } ] } ] }, { "type": "BLANK" } ] } ] }, "_assoc_tyinst": { "type": "SEQ", "members": [ { "type": "STRING", "value": "type" }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "instance" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "forall", "content": { "type": "SYMBOL", "name": "_forall" } }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_cond_assoc_tyinst" }, { "type": "SYMBOL", "name": "_type_instance_common" } ] }, "_assoc_datafam": { "type": "SEQ", "members": [ { "type": "STRING", "value": "data" }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "family" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_datafam" } ] }, "_assoc_datainst_adt": { "type": "SEQ", "members": [ { "type": "STRING", "value": "data" }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "instance" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_inst_adt" } ] }, "_assoc_datainst_newtype": { "type": "SEQ", "members": [ { "type": "STRING", "value": "newtype" }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "instance" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_inst_newtype" } ] }, "_assoc_datainst": { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_assoc_datainst_adt" }, "named": true, "value": "data_type" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_assoc_datainst_newtype" }, "named": true, "value": "newtype" } ] }, "default_signature": { "type": "SEQ", "members": [ { "type": "STRING", "value": "default" }, { "type": "FIELD", "name": "signature", "content": { "type": "SYMBOL", "name": "signature" } } ] }, "class_decl": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_local_decl" }, { "type": "SYMBOL", "name": "default_signature" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_assoc_tyfam" }, "named": true, "value": "type_family" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_assoc_tyinst" }, "named": true, "value": "type_instance" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_assoc_datafam" }, "named": true, "value": "data_family" } ] }, "fundep": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "matched", "content": { "type": "REPEAT1", "content": { "type": "SYMBOL", "name": "variable" } } }, { "type": "SYMBOL", "name": "_arrow" }, { "type": "FIELD", "name": "determined", "content": { "type": "REPEAT1", "content": { "type": "SYMBOL", "name": "variable" } } } ] }, "fundeps": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_bar" }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "fundep", "content": { "type": "SYMBOL", "name": "fundep" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "FIELD", "name": "fundep", "content": { "type": "SYMBOL", "name": "fundep" } } ] } } ] } ] }, "class_declarations": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_cmd_layout_start" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_cmd_layout_start_explicit" }, "named": false, "value": "{" } ] }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "declaration", "content": { "type": "SYMBOL", "name": "class_decl" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "FIELD", "name": "declaration", "content": { "type": "SYMBOL", "name": "class_decl" } } ] } } ] }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] } ] }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_layout_end" } ] }, "class": { "type": "SEQ", "members": [ { "type": "STRING", "value": "class" }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "context", "content": { "type": "SYMBOL", "name": "context" } }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_type_head" }, { "type": "FIELD", "name": "fundeps", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "fundeps" }, { "type": "BLANK" } ] } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_where" }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "declarations", "content": { "type": "SYMBOL", "name": "class_declarations" } }, { "type": "BLANK" } ] } ] }, { "type": "BLANK" } ] } ] }, "instance_decl": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "decl" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_assoc_datainst" }, "named": true, "value": "data_instance" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_assoc_tyinst" }, "named": true, "value": "type_instance" } ] }, "instance_declarations": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_cmd_layout_start" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_cmd_layout_start_explicit" }, "named": false, "value": "{" } ] }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "declaration", "content": { "type": "SYMBOL", "name": "instance_decl" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "FIELD", "name": "declaration", "content": { "type": "SYMBOL", "name": "instance_decl" } } ] } } ] }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] } ] }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_layout_end" } ] }, "_instance": { "type": "SEQ", "members": [ { "type": "STRING", "value": "instance" }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "forall", "content": { "type": "SYMBOL", "name": "_forall" } }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "context", "content": { "type": "SYMBOL", "name": "context" } }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_type_instance_head" } ] }, "instance": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_instance" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_where" }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "declarations", "content": { "type": "SYMBOL", "name": "instance_declarations" } }, { "type": "BLANK" } ] } ] }, { "type": "BLANK" } ] } ] }, "deriving_instance": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_phantom_deriving" }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "deriving" }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "strategy", "content": { "type": "SYMBOL", "name": "deriving_strategy" } }, { "type": "FIELD", "name": "via", "content": { "type": "SYMBOL", "name": "via" } } ] }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_instance" } ] }, "_fun_arrow_prec": { "type": "SEQ", "members": [ { "type": "STRING", "value": "-" }, { "type": "STRING", "value": "1" } ] }, "_fun_arrow_fixity": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "associativity", "content": { "type": "STRING", "value": "infixr" } }, { "type": "FIELD", "name": "precedence", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_fun_arrow_prec" }, "named": true, "value": "integer" } }, { "type": "FIELD", "name": "operator", "content": { "type": "ALIAS", "content": { "type": "STRING", "value": "->" }, "named": true, "value": "operator" } } ] }, "fixity": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_fun_arrow_fixity" }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "associativity", "content": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "infixl" }, { "type": "STRING", "value": "infixr" }, { "type": "STRING", "value": "infix" } ] } }, { "type": "FIELD", "name": "precedence", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "integer" }, { "type": "BLANK" } ] } }, { "type": "FIELD", "name": "operator", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_operator_minus" }, { "type": "SYMBOL", "name": "_varop" }, { "type": "SYMBOL", "name": "_conop" } ] }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_operator_minus" }, { "type": "SYMBOL", "name": "_varop" }, { "type": "SYMBOL", "name": "_conop" } ] } ] } } ] } } ] } ] }, "_con_binding_list": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "_con" } }, { "type": "REPEAT1", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "_con" } } ] } } ] }, "_var_binding_list": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "_var" } }, { "type": "REPEAT1", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "_var" } } ] } } ] }, "signature": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "_var" } }, { "type": "FIELD", "name": "names", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_var_binding_list" }, "named": true, "value": "binding_list" } } ] }, { "type": "SYMBOL", "name": "_type_annotation" } ] }, "_simple_bind_match": { "type": "SEQ", "members": [ { "type": "STRING", "value": "=" }, { "type": "FIELD", "name": "expression", "content": { "type": "SYMBOL", "name": "_exp" } } ] }, "_bind_match": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_guards" }, { "type": "STRING", "value": "=" }, { "type": "SYMBOL", "name": "_cmd_texp_end" }, { "type": "FIELD", "name": "expression", "content": { "type": "SYMBOL", "name": "_exp" } } ] }, "_bind_matches": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "match", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_simple_bind_match" }, "named": true, "value": "match" } }, { "type": "REPEAT1", "content": { "type": "FIELD", "name": "match", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_bind_match" }, "named": true, "value": "match" } } } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_where_binds" }, { "type": "BLANK" } ] } ] }, "_function_name": { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "_var" } }, "function_head_parens": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_function_head" }, { "type": "SYMBOL", "name": "_function_head_patterns" } ] }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "_function_head_patterns": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_function_name" }, { "type": "FIELD", "name": "parens", "content": { "type": "SYMBOL", "name": "function_head_parens" } } ] }, "_function_head_infix": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "left_operand", "content": { "type": "SYMBOL", "name": "pattern" } }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_cond_no_section_op" }, { "type": "BLANK" } ] }, { "type": "FIELD", "name": "operator", "content": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_minus" }, { "type": "SYMBOL", "name": "_operator_minus" } ] }, { "type": "SYMBOL", "name": "_varop" } ] } }, { "type": "FIELD", "name": "right_operand", "content": { "type": "SYMBOL", "name": "pattern" } } ] }, "_function_head": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_function_head_patterns" }, { "type": "FIELD", "name": "patterns", "content": { "type": "SYMBOL", "name": "patterns" } } ] }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_function_head_infix" }, "named": true, "value": "infix" } ] }, "function": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_function_head" }, { "type": "SYMBOL", "name": "_bind_matches" } ] }, "bind": { "type": "PREC", "value": "bind", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "pattern", "content": { "type": "SYMBOL", "name": "_pat" } }, { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "_var" } }, { "type": "FIELD", "name": "implicit", "content": { "type": "SYMBOL", "name": "implicit_variable" } } ] }, { "type": "SYMBOL", "name": "_bind_matches" } ] } }, "decl": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "signature" }, { "type": "SYMBOL", "name": "function" }, { "type": "SYMBOL", "name": "bind" } ] }, "_local_decl": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "fixity" }, { "type": "SYMBOL", "name": "decl" } ] }, "local_binds": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_cmd_layout_start" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_cmd_layout_start_explicit" }, "named": false, "value": "{" } ] }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "decl", "content": { "type": "SYMBOL", "name": "_local_decl" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "FIELD", "name": "decl", "content": { "type": "SYMBOL", "name": "_local_decl" } } ] } } ] }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] } ] }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_layout_end" } ] }, "_where_binds": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_where" }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "binds", "content": { "type": "SYMBOL", "name": "local_binds" } }, { "type": "BLANK" } ] } ] }, "calling_convention": { "type": "TOKEN", "content": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "ccall" }, { "type": "STRING", "value": "stdcall" }, { "type": "STRING", "value": "capi" }, { "type": "STRING", "value": "prim" }, { "type": "STRING", "value": "javascript" }, { "type": "PATTERN", "value": "[A-Z_]+" } ] } }, "safety": { "type": "TOKEN", "content": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "unsafe" }, { "type": "STRING", "value": "safe" }, { "type": "STRING", "value": "interruptible" } ] } }, "entity": { "type": "SYMBOL", "name": "string" }, "foreign_import": { "type": "SEQ", "members": [ { "type": "STRING", "value": "foreign" }, { "type": "STRING", "value": "import" }, { "type": "FIELD", "name": "calling_convention", "content": { "type": "SYMBOL", "name": "calling_convention" } }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "safety", "content": { "type": "SYMBOL", "name": "safety" } }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "entity", "content": { "type": "SYMBOL", "name": "entity" } }, { "type": "BLANK" } ] }, { "type": "FIELD", "name": "signature", "content": { "type": "SYMBOL", "name": "signature" } } ] }, "foreign_export": { "type": "SEQ", "members": [ { "type": "STRING", "value": "foreign" }, { "type": "STRING", "value": "export" }, { "type": "FIELD", "name": "calling_convention", "content": { "type": "SYMBOL", "name": "calling_convention" } }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "entity", "content": { "type": "SYMBOL", "name": "entity" } }, { "type": "BLANK" } ] }, { "type": "FIELD", "name": "signature", "content": { "type": "SYMBOL", "name": "signature" } } ] }, "default_types": { "type": "SEQ", "members": [ { "type": "STRING", "value": "default" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "_ktype" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "_ktype" } } ] } } ] }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_paren_close" } ] } ] }, "_patsyn_signature": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "synonym", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_con" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_con_binding_list" }, "named": true, "value": "binding_list" } ] } }, { "type": "SYMBOL", "name": "_colon2" }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "quantified_type" } } ] }, "_patsyn_cons": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_cmd_layout_start" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_cmd_layout_start_explicit" }, "named": false, "value": "{" } ] }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] }, { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "bind" }, "named": true, "value": "constructor_synonym" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "bind" }, "named": true, "value": "constructor_synonym" } ] } } ] }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] } ] }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_layout_end" } ] }, "_patsyn_equation": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "synonym", "content": { "type": "SYMBOL", "name": "pattern" } }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "=" }, { "type": "SYMBOL", "name": "_larrow" } ] }, { "type": "FIELD", "name": "pattern", "content": { "type": "SYMBOL", "name": "_pat" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_where" }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "constructors", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_patsyn_cons" }, "named": true, "value": "constructor_synonyms" } }, { "type": "BLANK" } ] } ] }, { "type": "BLANK" } ] } ] }, "pattern_synonym": { "type": "SEQ", "members": [ { "type": "STRING", "value": "pattern" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_patsyn_signature" }, "named": true, "value": "signature" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_patsyn_equation" }, "named": true, "value": "equation" } ] } ] }, "_splice_exp": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_exp_name" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp_parens" }, "named": true, "value": "parens" }, { "type": "SYMBOL", "name": "literal" } ] }, "_splice_dollars": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_splice" }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "$" }, { "type": "STRING", "value": "$$" } ] } ] }, "splice": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_splice_dollars" }, { "type": "FIELD", "name": "expression", "content": { "type": "SYMBOL", "name": "_splice_exp" } } ] }, "top_splice": { "type": "SYMBOL", "name": "expression" }, "quoter": { "type": "SYMBOL", "name": "_varids" }, "quasiquote": { "type": "SEQ", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_quote_start" }, { "type": "STRING", "value": "[" }, { "type": "FIELD", "name": "quoter", "content": { "type": "SYMBOL", "name": "quoter" } }, { "type": "STRING", "value": "|" } ] }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "body", "content": { "type": "SYMBOL", "name": "quasiquote_body" } }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "TOKEN", "content": { "type": "STRING", "value": "|]" } }, { "type": "STRING", "value": "⟧" } ] } ] }, "quoted_decls": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_cmd_layout_start_quote" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_cmd_layout_start_explicit" }, "named": false, "value": "{" } ] }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "declaration", "content": { "type": "SYMBOL", "name": "declaration" } }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "FIELD", "name": "declaration", "content": { "type": "SYMBOL", "name": "declaration" } } ] } } ] }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "REPEAT1", "content": { "type": "STRING", "value": ";" } }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" } ] }, { "type": "BLANK" } ] } ] }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_layout_end" } ] }, "_exp_quote": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "STRING", "value": "⟦" }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_quote_start" }, { "type": "STRING", "value": "[" }, { "type": "FIELD", "name": "quoter", "content": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "e" }, { "type": "BLANK" } ] } }, { "type": "STRING", "value": "|" } ] } ] }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp" }, "named": true, "value": "quoted_expression" }, { "type": "BLANK" } ] } ] }, { "type": "SEQ", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_quote_start" }, { "type": "STRING", "value": "[" }, { "type": "FIELD", "name": "quoter", "content": { "type": "STRING", "value": "t" } }, { "type": "STRING", "value": "|" } ] }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_ktype" }, "named": true, "value": "quoted_type" }, { "type": "BLANK" } ] } ] }, { "type": "SEQ", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_quote_start" }, { "type": "STRING", "value": "[" }, { "type": "FIELD", "name": "quoter", "content": { "type": "STRING", "value": "p" } }, { "type": "STRING", "value": "|" } ] }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_pat" }, "named": true, "value": "quoted_pattern" }, { "type": "BLANK" } ] } ] }, { "type": "SEQ", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_quote_start" }, { "type": "STRING", "value": "[" }, { "type": "FIELD", "name": "quoter", "content": { "type": "STRING", "value": "d" } }, { "type": "STRING", "value": "|" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "quoted_decls" }, { "type": "BLANK" } ] } ] } ] }, { "type": "CHOICE", "members": [ { "type": "TOKEN", "content": { "type": "STRING", "value": "|]" } }, { "type": "STRING", "value": "⟧" } ] } ] }, "_exp_typed_quote": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_quote_start" }, { "type": "STRING", "value": "[" }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "e" }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "||" }, { "type": "CHOICE", "members": [ { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_exp" }, "named": true, "value": "quoted_expression" }, { "type": "BLANK" } ] }, { "type": "TOKEN", "content": { "type": "STRING", "value": "||]" } } ] }, "float": { "type": "TOKEN", "content": { "type": "SEQ", "members": [ { "type": "SEQ", "members": [ { "type": "PATTERN", "value": "[0-9][0-9_]*" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "PATTERN", "value": "\\.[0-9_]+" }, { "type": "CHOICE", "members": [ { "type": "PATTERN", "value": "[eE][+-]?[0-9_]+" }, { "type": "BLANK" } ] } ] }, { "type": "PATTERN", "value": "[eE][+-]?[0-9_]+" } ] } ] }, { "type": "CHOICE", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "PATTERN", "value": "##?" } }, { "type": "BLANK" } ] } ] } }, "char": { "type": "TOKEN", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "PATTERN", "value": "'[^']'" }, { "type": "PATTERN", "value": "'\\\\[^ ]*'" } ] }, { "type": "CHOICE", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "PATTERN", "value": "##?" } }, { "type": "BLANK" } ] } ] } }, "string": { "type": "TOKEN", "content": { "type": "SEQ", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "\"" }, { "type": "REPEAT", "content": { "type": "CHOICE", "members": [ { "type": "PATTERN", "value": "[^\\\\\"\\n]" }, { "type": "PATTERN", "value": "\\\\(\\^)?." }, { "type": "PATTERN", "value": "\\\\\\n\\s*\\\\" } ] } }, { "type": "STRING", "value": "\"" } ] }, { "type": "CHOICE", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "PATTERN", "value": "##?" } }, { "type": "BLANK" } ] } ] } }, "_integer_literal": { "type": "TOKEN", "content": { "type": "SEQ", "members": [ { "type": "PATTERN", "value": "[0-9][0-9_]*" }, { "type": "CHOICE", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "PATTERN", "value": "##?" } }, { "type": "BLANK" } ] } ] } }, "_binary_literal": { "type": "TOKEN", "content": { "type": "SEQ", "members": [ { "type": "PATTERN", "value": "0[bB][01_]+" }, { "type": "CHOICE", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "PATTERN", "value": "##?" } }, { "type": "BLANK" } ] } ] } }, "_octal_literal": { "type": "TOKEN", "content": { "type": "SEQ", "members": [ { "type": "PATTERN", "value": "0[oO][0-7]+" }, { "type": "CHOICE", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "PATTERN", "value": "##?" } }, { "type": "BLANK" } ] } ] } }, "_hex_literal": { "type": "TOKEN", "content": { "type": "SEQ", "members": [ { "type": "SEQ", "members": [ { "type": "PATTERN", "value": "0[xX][0-9a-fA-F_]+" }, { "type": "CHOICE", "members": [ { "type": "PATTERN", "value": "\\.[0-9a-fA-F_]+" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "PATTERN", "value": "[pP][+-]?[0-9a-fA-F_]+" }, { "type": "BLANK" } ] } ] }, { "type": "CHOICE", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "PATTERN", "value": "##?" } }, { "type": "BLANK" } ] } ] } }, "integer": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_binary_literal" }, { "type": "SYMBOL", "name": "_integer_literal" }, { "type": "SYMBOL", "name": "_octal_literal" }, { "type": "SYMBOL", "name": "_hex_literal" } ] }, "_stringly": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "string" }, { "type": "SYMBOL", "name": "char" } ] }, "_number": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "integer" }, { "type": "SYMBOL", "name": "float" } ] }, "_plist": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_bracket_open" }, { "type": "SYMBOL", "name": "_bracket_close" } ] }, "unit": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "unboxed_unit": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_unboxed_open" }, { "type": "SYMBOL", "name": "_unboxed_close" } ] }, "prefix_tuple": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "REPEAT1", "content": { "type": "STRING", "value": "," } }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "prefix_unboxed_tuple": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_unboxed_open" }, { "type": "REPEAT1", "content": { "type": "STRING", "value": "," } }, { "type": "SYMBOL", "name": "_unboxed_close" } ] }, "prefix_unboxed_sum": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_unboxed_open" }, { "type": "REPEAT1", "content": { "type": "SYMBOL", "name": "_unboxed_bar" } }, { "type": "SYMBOL", "name": "_unboxed_close" } ] }, "literal": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_stringly" }, { "type": "SYMBOL", "name": "_number" } ] }, "_unit_cons": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "unit" }, { "type": "SYMBOL", "name": "unboxed_unit" } ] }, "_tuple_cons": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "prefix_tuple" }, { "type": "SYMBOL", "name": "prefix_unboxed_tuple" }, { "type": "SYMBOL", "name": "prefix_unboxed_sum" } ] }, "_qualified_variable": { "type": "PREC", "value": "qualified-id", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "module", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qualifying_module" }, "named": true, "value": "module" } }, { "type": "FIELD", "name": "id", "content": { "type": "SYMBOL", "name": "variable" } } ] } }, "_qvarid": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qualified_variable" }, "named": true, "value": "qualified" }, "_varids": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_qvarid" }, { "type": "SYMBOL", "name": "variable" } ] }, "_var": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "variable" }, { "type": "SYMBOL", "name": "_pvarsym" } ] }, "_qvar": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_qvarid" }, { "type": "SYMBOL", "name": "_pqvarsym" } ] }, "_vars": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_var" }, { "type": "SYMBOL", "name": "_qvar" } ] }, "_variable_ticked": { "type": "SEQ", "members": [ { "type": "STRING", "value": "`" }, { "type": "SYMBOL", "name": "variable" }, { "type": "STRING", "value": "`" } ] }, "_varop": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "operator" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_variable_ticked" }, "named": true, "value": "infix_id" } ] }, "_qvariable_ticked": { "type": "SEQ", "members": [ { "type": "STRING", "value": "`" }, { "type": "SYMBOL", "name": "_qvarid" }, { "type": "STRING", "value": "`" } ] }, "_varids_ticked": { "type": "ALIAS", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_variable_ticked" }, { "type": "SYMBOL", "name": "_qvariable_ticked" } ] }, "named": true, "value": "infix_id" }, "_constructor": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "name" }, "named": true, "value": "constructor" }, "_qualified_constructor": { "type": "PREC", "value": "qualified-id", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "module", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qualifying_module" }, "named": true, "value": "module" } }, { "type": "FIELD", "name": "id", "content": { "type": "SYMBOL", "name": "_constructor" } } ] } }, "_qconid": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qualified_constructor" }, "named": true, "value": "qualified" }, "_conids": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_qconid" }, { "type": "SYMBOL", "name": "_constructor" } ] }, "_con": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_constructor" }, { "type": "SYMBOL", "name": "_pconsym" } ] }, "_qcon": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_qconid" }, { "type": "SYMBOL", "name": "_pqconsym" } ] }, "_cons": { "type": "CHOICE", "members": [ { "type": "PREC", "value": "con", "content": { "type": "SYMBOL", "name": "_con" } }, { "type": "SYMBOL", "name": "_qcon" } ] }, "_constructor_ticked": { "type": "SEQ", "members": [ { "type": "STRING", "value": "`" }, { "type": "SYMBOL", "name": "_constructor" }, { "type": "STRING", "value": "`" } ] }, "_conop": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_constructor_operator_alias" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_constructor_ticked" }, "named": true, "value": "infix_id" } ] }, "_qconstructor_ticked": { "type": "SEQ", "members": [ { "type": "STRING", "value": "`" }, { "type": "SYMBOL", "name": "_qconid" }, { "type": "STRING", "value": "`" } ] }, "_conids_ticked": { "type": "ALIAS", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_constructor_ticked" }, { "type": "SYMBOL", "name": "_qconstructor_ticked" } ] }, "named": true, "value": "infix_id" }, "_tyconid": { "type": "SYMBOL", "name": "name" }, "_qualified_type": { "type": "PREC", "value": "qualified-id", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "module", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qualifying_module" }, "named": true, "value": "module" } }, { "type": "FIELD", "name": "id", "content": { "type": "SYMBOL", "name": "_tyconid" } } ] } }, "_qtyconid": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qualified_type" }, "named": true, "value": "qualified" }, "_tyconids": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_qtyconid" }, { "type": "SYMBOL", "name": "_tyconid" } ] }, "_tycon_arrow": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_arrow" }, "named": true, "value": "operator" }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "_qualified_arrow": { "type": "PREC", "value": "qualified-id", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "module", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qualifying_module" }, "named": true, "value": "module" } }, { "type": "FIELD", "name": "id", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_arrow" }, "named": true, "value": "operator" } } ] } }, "_qtycon_arrow": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qualified_arrow" }, "named": true, "value": "qualified" }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "_tycon": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_tyconid" }, { "type": "SYMBOL", "name": "_pvarsym" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_tycon_arrow" }, "named": true, "value": "prefix_id" }, { "type": "SYMBOL", "name": "_pconsym" } ] }, "_qtycon": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_qtyconid" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qtycon_arrow" }, "named": true, "value": "prefix_id" }, { "type": "SYMBOL", "name": "_pqsym" } ] }, "_tycons": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_tycon" }, { "type": "SYMBOL", "name": "_qtycon" } ] }, "_promoted_tycons_alias": { "type": "SEQ", "members": [ { "type": "STRING", "value": "'" }, { "type": "SYMBOL", "name": "_cons" } ] }, "_promoted_tycons": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_promoted_tycons_alias" }, "named": true, "value": "promoted" }, "_tycon_ticked": { "type": "SEQ", "members": [ { "type": "STRING", "value": "`" }, { "type": "SYMBOL", "name": "_tyconid" }, { "type": "STRING", "value": "`" } ] }, "_qtycon_ticked": { "type": "SEQ", "members": [ { "type": "STRING", "value": "`" }, { "type": "SYMBOL", "name": "_qtyconid" }, { "type": "STRING", "value": "`" } ] }, "_tyconids_ticked": { "type": "ALIAS", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_tycon_ticked" }, { "type": "SYMBOL", "name": "_qtycon_ticked" } ] }, "named": true, "value": "infix_id" }, "_tyconops": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_sym" }, { "type": "SYMBOL", "name": "_qsym" }, { "type": "SYMBOL", "name": "_operator_minus" }, { "type": "SYMBOL", "name": "_tyconids_ticked" } ] }, "_promoted_tyconops_alias": { "type": "SEQ", "members": [ { "type": "STRING", "value": "'" }, { "type": "SYMBOL", "name": "_tyconops" } ] }, "_promoted_tyconops": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_promoted_tyconops_alias" }, "named": true, "value": "promoted" }, "_tyops": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_tyconops" }, { "type": "SYMBOL", "name": "_promoted_tyconops" } ] }, "_op_ticked": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_varids_ticked" }, { "type": "SYMBOL", "name": "_conids_ticked" } ] }, "_ops": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "operator" }, { "type": "SYMBOL", "name": "_qvarsym" }, { "type": "SYMBOL", "name": "constructor_operator" }, { "type": "SYMBOL", "name": "_qconsym" }, { "type": "SYMBOL", "name": "_op_ticked" } ] }, "_name": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_var" }, { "type": "SYMBOL", "name": "_con" } ] }, "_qname": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_vars" }, { "type": "SYMBOL", "name": "_cons" } ] }, "_operator_qual_dot_head": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_qual_dot" }, { "type": "SYMBOL", "name": "_varsym" } ] }, "_operator_hash_head": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "STRING", "value": "#" }, { "type": "IMMEDIATE_TOKEN", "content": { "type": "STRING", "value": "#" } } ] }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "IMMEDIATE_TOKEN", "content": { "type": "STRING", "value": "#" } }, { "type": "IMMEDIATE_TOKEN", "content": { "type": "STRING", "value": "|" } } ] }, { "type": "BLANK" } ] } ] }, "operator": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_cond_prefix_dot" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "_varsym" } ] }, { "type": "SYMBOL", "name": "_operator_hash_head" }, { "type": "STRING", "value": "*" } ] }, "_operator_alias": { "type": "SYMBOL", "name": "operator" }, "_operator_minus": { "type": "ALIAS", "content": { "type": "STRING", "value": "-" }, "named": true, "value": "operator" }, "_varsym_prefix": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "operator" }, { "type": "SYMBOL", "name": "_operator_minus" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_operator_qual_dot_head" }, "named": true, "value": "operator" } ] }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "_pvarsym": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_varsym_prefix" }, "named": true, "value": "prefix_id" }, "_qualified_varsym": { "type": "PREC", "value": "qualified-id", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "module", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qualifying_module" }, "named": true, "value": "module" } }, { "type": "FIELD", "name": "id", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "operator" }, { "type": "SYMBOL", "name": "_operator_minus" } ] } } ] } }, "_qvarsym": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qualified_varsym" }, "named": true, "value": "qualified" }, "_qvarsym_prefix": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "SYMBOL", "name": "_qvarsym" }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "_pqvarsym": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qvarsym_prefix" }, "named": true, "value": "prefix_id" }, "constructor_operator": { "type": "SYMBOL", "name": "_consym" }, "_constructor_operator_alias": { "type": "SYMBOL", "name": "constructor_operator" }, "_consym_prefix": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "SYMBOL", "name": "constructor_operator" }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "_pconsym": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_consym_prefix" }, "named": true, "value": "prefix_id" }, "_qualified_consym": { "type": "PREC", "value": "qualified-id", "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "module", "content": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qualifying_module" }, "named": true, "value": "module" } }, { "type": "FIELD", "name": "id", "content": { "type": "SYMBOL", "name": "constructor_operator" } } ] } }, "_qconsym": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qualified_consym" }, "named": true, "value": "qualified" }, "_qconsym_prefix": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "SYMBOL", "name": "_qconsym" }, { "type": "SYMBOL", "name": "_paren_close" } ] }, "_pqconsym": { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_qconsym_prefix" }, "named": true, "value": "prefix_id" }, "_sym": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_operator_alias" }, { "type": "SYMBOL", "name": "_constructor_operator_alias" } ] }, "_sym_prefix": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_pvarsym" }, { "type": "SYMBOL", "name": "_pconsym" } ] }, "_qsym": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_qvarsym" }, { "type": "SYMBOL", "name": "_qconsym" } ] }, "_pqsym": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_pqvarsym" }, { "type": "SYMBOL", "name": "_pqconsym" } ] }, "variable": { "type": "TOKEN", "content": { "type": "SEQ", "members": [ { "type": "PATTERN", "value": "[_\\p{Ll}\\p{Lo}]" }, { "type": "PATTERN", "value": "[\\pL\\p{Mn}\\pN_']*" }, { "type": "PATTERN", "value": "#*" } ] } }, "implicit_variable": { "type": "TOKEN", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "?" }, { "type": "PATTERN", "value": "[_\\p{Ll}\\p{Lo}]" }, { "type": "PATTERN", "value": "[\\pL\\p{Mn}\\pN_']*" } ] } }, "name": { "type": "TOKEN", "content": { "type": "SEQ", "members": [ { "type": "PATTERN", "value": "[\\p{Lu}\\p{Lt}]" }, { "type": "PATTERN", "value": "[\\pL\\p{Mn}\\pN_']*" }, { "type": "PATTERN", "value": "#*" } ] } }, "label": { "type": "TOKEN", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "#" }, { "type": "PATTERN", "value": "[_\\p{Ll}\\p{Lo}]" }, { "type": "PATTERN", "value": "[\\pL\\p{Mn}\\pN_']*" } ] } }, "_carrow": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "=>" }, { "type": "STRING", "value": "⇒" } ] }, "_arrow": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "->" }, { "type": "STRING", "value": "→" } ] }, "_linear_arrow": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "->." }, { "type": "STRING", "value": "⊸" } ] }, "_larrow": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "<-" }, { "type": "STRING", "value": "←" } ] }, "_colon2": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "::" }, { "type": "STRING", "value": "∷" } ] }, "_promote": { "type": "STRING", "value": "'" }, "_qual_dot": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_qual_dot" }, { "type": "STRING", "value": "." } ] }, "_tight_dot": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_tight_dot" }, { "type": "STRING", "value": "." } ] }, "_any_tight_dot": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_qual_dot" }, { "type": "SYMBOL", "name": "_tight_dot" } ] }, "_prefix_dot": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_prefix_dot" }, { "type": "STRING", "value": "." } ] }, "_any_prefix_dot": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_qual_dot" }, { "type": "SYMBOL", "name": "_prefix_dot" } ] }, "_tight_at": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_tight_at" }, { "type": "STRING", "value": "@" } ] }, "_prefix_at": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_prefix_at" }, { "type": "STRING", "value": "@" } ] }, "_prefix_bang": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_prefix_bang" }, { "type": "STRING", "value": "!" } ] }, "_tight_bang": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_tight_bang" }, { "type": "STRING", "value": "!" } ] }, "_any_prefix_bang": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_prefix_bang" }, { "type": "SYMBOL", "name": "_tight_bang" } ] }, "_prefix_tilde": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_prefix_tilde" }, { "type": "STRING", "value": "~" } ] }, "_tight_tilde": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_tight_tilde" }, { "type": "STRING", "value": "~" } ] }, "_any_prefix_tilde": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_prefix_tilde" }, { "type": "SYMBOL", "name": "_tight_tilde" } ] }, "_prefix_percent": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_prefix_percent" }, { "type": "STRING", "value": "%" } ] }, "_dotdot": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_cond_dotdot" }, { "type": "STRING", "value": ".." } ] }, "_paren_open": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "\\(" }, "named": false, "value": "(" }, { "type": "SYMBOL", "name": "_cmd_texp_start" } ] }, "_paren_close": { "type": "SEQ", "members": [ { "type": "ALIAS", "content": { "type": "PATTERN", "value": "\\)" }, "named": false, "value": ")" }, { "type": "SYMBOL", "name": "_cmd_texp_end" } ] }, "_bracket_open": { "type": "SEQ", "members": [ { "type": "STRING", "value": "[" }, { "type": "SYMBOL", "name": "_cmd_texp_start" } ] }, "_bracket_close": { "type": "SEQ", "members": [ { "type": "STRING", "value": "]" }, { "type": "SYMBOL", "name": "_cmd_texp_end" } ] }, "_unboxed_open": { "type": "ALIAS", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_paren_open" }, { "type": "IMMEDIATE_TOKEN", "content": { "type": "STRING", "value": "#" } } ] }, "named": false, "value": "(#" }, "_unboxed_close": { "type": "SEQ", "members": [ { "type": "STRING", "value": "#)" }, { "type": "SYMBOL", "name": "_cmd_texp_end" } ] }, "_unboxed_bar": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "|" }, { "type": "IMMEDIATE_TOKEN", "content": { "type": "STRING", "value": "|" } } ] }, "_where": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_phantom_where" }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "where" } ] }, "_bar": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_phantom_bar" }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "|" } ] } }, "extras": [ { "type": "PATTERN", "value": "\\p{Zs}" }, { "type": "PATTERN", "value": "\\n" }, { "type": "PATTERN", "value": "\\r" }, { "type": "SYMBOL", "name": "cpp" }, { "type": "SYMBOL", "name": "comment" }, { "type": "SYMBOL", "name": "haddock" }, { "type": "SYMBOL", "name": "pragma" } ], "conflicts": [ [ "_function_name", "pattern" ], [ "_function_name", "pattern", "expression" ], [ "pattern", "expression" ], [ "signature", "pattern" ], [ "_operator_hash_head", "_unboxed_open" ] ], "precedences": [ [ { "type": "STRING", "value": "projection" }, { "type": "STRING", "value": "record" }, { "type": "STRING", "value": "prefix" }, { "type": "STRING", "value": "apply" }, { "type": "STRING", "value": "negation" }, { "type": "STRING", "value": "infix" }, { "type": "STRING", "value": "implicit" }, { "type": "STRING", "value": "fun" }, { "type": "STRING", "value": "annotated" }, { "type": "SYMBOL", "name": "quantified_type" } ], [ { "type": "SYMBOL", "name": "_pat_negation" }, { "type": "SYMBOL", "name": "literal" } ], [ { "type": "STRING", "value": "bind" }, { "type": "STRING", "value": "pat-name" } ], [ { "type": "STRING", "value": "qualifying-module" }, { "type": "STRING", "value": "qualified-id" } ], [ { "type": "STRING", "value": "qualifying-module" }, { "type": "STRING", "value": "con" } ], [ { "type": "STRING", "value": "qualifying-module" }, { "type": "STRING", "value": "type-name" } ], [ { "type": "SYMBOL", "name": "operator" }, { "type": "SYMBOL", "name": "_type_star" } ], [ { "type": "SYMBOL", "name": "_type_wildcard" }, { "type": "SYMBOL", "name": "_type_param_wildcard" } ], [ { "type": "SYMBOL", "name": "_constructor_ticked" }, { "type": "SYMBOL", "name": "_tycon_ticked" } ], [ { "type": "STRING", "value": "qtype-single" }, { "type": "STRING", "value": "qtype-curried" } ], [ { "type": "STRING", "value": "patterns" }, { "type": "STRING", "value": "apply" } ] ], "externals": [ { "type": "SYMBOL", "name": "error_sentinel" }, { "type": "SYMBOL", "name": "_cond_layout_semicolon" }, { "type": "SYMBOL", "name": "_cmd_layout_start" }, { "type": "SYMBOL", "name": "_cmd_layout_start_do" }, { "type": "SYMBOL", "name": "_cmd_layout_start_case" }, { "type": "SYMBOL", "name": "_cmd_layout_start_if" }, { "type": "SYMBOL", "name": "_cmd_layout_start_let" }, { "type": "SYMBOL", "name": "_cmd_layout_start_quote" }, { "type": "SYMBOL", "name": "_cmd_layout_start_explicit" }, { "type": "SYMBOL", "name": "_cond_layout_end" }, { "type": "SYMBOL", "name": "_cond_layout_end_explicit" }, { "type": "SYMBOL", "name": "_cmd_brace_open" }, { "type": "SYMBOL", "name": "_cmd_brace_close" }, { "type": "SYMBOL", "name": "_cmd_texp_start" }, { "type": "SYMBOL", "name": "_cmd_texp_end" }, { "type": "SYMBOL", "name": "_phantom_where" }, { "type": "SYMBOL", "name": "_phantom_in" }, { "type": "SYMBOL", "name": "_phantom_arrow" }, { "type": "SYMBOL", "name": "_phantom_bar" }, { "type": "SYMBOL", "name": "_phantom_deriving" }, { "type": "SYMBOL", "name": "comment" }, { "type": "SYMBOL", "name": "haddock" }, { "type": "SYMBOL", "name": "cpp" }, { "type": "SYMBOL", "name": "pragma" }, { "type": "SYMBOL", "name": "_cond_quote_start" }, { "type": "SYMBOL", "name": "quasiquote_body" }, { "type": "SYMBOL", "name": "_cond_splice" }, { "type": "SYMBOL", "name": "_cond_qual_dot" }, { "type": "SYMBOL", "name": "_cond_tight_dot" }, { "type": "SYMBOL", "name": "_cond_prefix_dot" }, { "type": "SYMBOL", "name": "_cond_dotdot" }, { "type": "SYMBOL", "name": "_cond_tight_at" }, { "type": "SYMBOL", "name": "_cond_prefix_at" }, { "type": "SYMBOL", "name": "_cond_tight_bang" }, { "type": "SYMBOL", "name": "_cond_prefix_bang" }, { "type": "SYMBOL", "name": "_cond_tight_tilde" }, { "type": "SYMBOL", "name": "_cond_prefix_tilde" }, { "type": "SYMBOL", "name": "_cond_prefix_percent" }, { "type": "SYMBOL", "name": "_cond_qualified_op" }, { "type": "SYMBOL", "name": "_cond_left_section_op" }, { "type": "SYMBOL", "name": "_cond_no_section_op" }, { "type": "SYMBOL", "name": "_cond_minus" }, { "type": "SYMBOL", "name": "_cond_context" }, { "type": "SYMBOL", "name": "_cond_infix" }, { "type": "SYMBOL", "name": "_cond_data_infix" }, { "type": "SYMBOL", "name": "_cond_assoc_tyinst" }, { "type": "SYMBOL", "name": "_varsym" }, { "type": "SYMBOL", "name": "_consym" }, { "type": "PATTERN", "value": "\\n" } ], "inline": [ "_var", "_vars", "_varids", "_varids_ticked", "_varop", "_constructor", "_con", "_qcon", "_cons", "_conids", "_conids_ticked", "_conop", "_op_ticked", "_modid", "_qvarsym", "_qconsym", "_sym", "_qsym", "_pqsym", "_any_prefix_dot", "_any_tight_dot", "_unboxed_bar", "_exp_name", "_exp_greedy", "_let", "_pat_apply_arg", "_pat_name", "_pat_texp", "_tyconid", "_tyconids", "_tycon", "_qtycon", "_tycons", "_tyconops", "_tyops", "_type_name", "_forall", "_type_apply_arg", "_parameter_type", "_field_type", "_type_head", "_type_instance_head", "_type_annotation", "_kind_annotation", "_number", "_stringly", "_unit_cons", "_tuple_cons", "_universal", "_function_head_patterns", "_function_head" ], "supertypes": [ "expression", "pattern", "type", "quantified_type", "constraint", "constraints", "type_param", "declaration", "decl", "class_decl", "instance_decl", "statement", "qualifier", "guard" ] } ================================================ FILE: src/node-types.json ================================================ [ { "type": "class_decl", "named": true, "subtypes": [ { "type": "data_family", "named": true }, { "type": "decl", "named": true }, { "type": "default_signature", "named": true }, { "type": "fixity", "named": true }, { "type": "type_family", "named": true }, { "type": "type_instance", "named": true } ] }, { "type": "constraint", "named": true, "subtypes": [ { "type": "apply", "named": true }, { "type": "infix", "named": true }, { "type": "literal", "named": true }, { "type": "name", "named": true }, { "type": "parens", "named": true }, { "type": "prefix_id", "named": true }, { "type": "prefix_tuple", "named": true }, { "type": "prefix_unboxed_sum", "named": true }, { "type": "prefix_unboxed_tuple", "named": true }, { "type": "promoted", "named": true }, { "type": "qualified", "named": true }, { "type": "quasiquote", "named": true }, { "type": "splice", "named": true }, { "type": "tuple", "named": true }, { "type": "unboxed_unit", "named": true }, { "type": "unit", "named": true }, { "type": "variable", "named": true }, { "type": "wildcard", "named": true } ] }, { "type": "constraints", "named": true, "subtypes": [ { "type": "constraint", "named": true }, { "type": "context", "named": true }, { "type": "forall", "named": true }, { "type": "implicit_parameter", "named": true }, { "type": "signature", "named": true } ] }, { "type": "decl", "named": true, "subtypes": [ { "type": "bind", "named": true }, { "type": "function", "named": true }, { "type": "signature", "named": true } ] }, { "type": "declaration", "named": true, "subtypes": [ { "type": "class", "named": true }, { "type": "data_family", "named": true }, { "type": "data_instance", "named": true }, { "type": "data_type", "named": true }, { "type": "decl", "named": true }, { "type": "default_types", "named": true }, { "type": "deriving_instance", "named": true }, { "type": "fixity", "named": true }, { "type": "foreign_export", "named": true }, { "type": "foreign_import", "named": true }, { "type": "instance", "named": true }, { "type": "kind_signature", "named": true }, { "type": "newtype", "named": true }, { "type": "pattern_synonym", "named": true }, { "type": "role_annotation", "named": true }, { "type": "top_splice", "named": true }, { "type": "type_family", "named": true }, { "type": "type_instance", "named": true }, { "type": "type_synomym", "named": true } ] }, { "type": "expression", "named": true, "subtypes": [ { "type": "apply", "named": true }, { "type": "arithmetic_sequence", "named": true }, { "type": "case", "named": true }, { "type": "conditional", "named": true }, { "type": "constructor", "named": true }, { "type": "do", "named": true }, { "type": "implicit_variable", "named": true }, { "type": "infix", "named": true }, { "type": "label", "named": true }, { "type": "lambda", "named": true }, { "type": "lambda_case", "named": true }, { "type": "lambda_cases", "named": true }, { "type": "left_section", "named": true }, { "type": "let_in", "named": true }, { "type": "list", "named": true }, { "type": "list_comprehension", "named": true }, { "type": "literal", "named": true }, { "type": "multi_way_if", "named": true }, { "type": "negation", "named": true }, { "type": "parens", "named": true }, { "type": "prefix_id", "named": true }, { "type": "prefix_tuple", "named": true }, { "type": "prefix_unboxed_sum", "named": true }, { "type": "prefix_unboxed_tuple", "named": true }, { "type": "projection", "named": true }, { "type": "projection_selector", "named": true }, { "type": "qualified", "named": true }, { "type": "quasiquote", "named": true }, { "type": "quote", "named": true }, { "type": "record", "named": true }, { "type": "right_section", "named": true }, { "type": "splice", "named": true }, { "type": "th_quoted_name", "named": true }, { "type": "tuple", "named": true }, { "type": "typed_quote", "named": true }, { "type": "unboxed_sum", "named": true }, { "type": "unboxed_tuple", "named": true }, { "type": "unboxed_unit", "named": true }, { "type": "unit", "named": true }, { "type": "variable", "named": true } ] }, { "type": "guard", "named": true, "subtypes": [ { "type": "boolean", "named": true }, { "type": "let", "named": true }, { "type": "pattern_guard", "named": true } ] }, { "type": "instance_decl", "named": true, "subtypes": [ { "type": "data_instance", "named": true }, { "type": "decl", "named": true }, { "type": "type_instance", "named": true } ] }, { "type": "pattern", "named": true, "subtypes": [ { "type": "apply", "named": true }, { "type": "as", "named": true }, { "type": "constructor", "named": true }, { "type": "infix", "named": true }, { "type": "irrefutable", "named": true }, { "type": "list", "named": true }, { "type": "literal", "named": true }, { "type": "negation", "named": true }, { "type": "parens", "named": true }, { "type": "prefix_id", "named": true }, { "type": "prefix_tuple", "named": true }, { "type": "prefix_unboxed_sum", "named": true }, { "type": "prefix_unboxed_tuple", "named": true }, { "type": "qualified", "named": true }, { "type": "quasiquote", "named": true }, { "type": "record", "named": true }, { "type": "splice", "named": true }, { "type": "strict", "named": true }, { "type": "tuple", "named": true }, { "type": "unboxed_sum", "named": true }, { "type": "unboxed_tuple", "named": true }, { "type": "unboxed_unit", "named": true }, { "type": "unit", "named": true }, { "type": "variable", "named": true }, { "type": "wildcard", "named": true } ] }, { "type": "qualifier", "named": true, "subtypes": [ { "type": "boolean", "named": true }, { "type": "generator", "named": true }, { "type": "group", "named": true }, { "type": "let", "named": true }, { "type": "transform", "named": true } ] }, { "type": "quantified_type", "named": true, "subtypes": [ { "type": "context", "named": true }, { "type": "forall", "named": true }, { "type": "forall_required", "named": true }, { "type": "function", "named": true }, { "type": "implicit_parameter", "named": true }, { "type": "linear_function", "named": true }, { "type": "type", "named": true } ] }, { "type": "statement", "named": true, "subtypes": [ { "type": "bind", "named": true }, { "type": "exp", "named": true }, { "type": "let", "named": true }, { "type": "rec", "named": true } ] }, { "type": "type", "named": true, "subtypes": [ { "type": "apply", "named": true }, { "type": "infix", "named": true }, { "type": "list", "named": true }, { "type": "literal", "named": true }, { "type": "name", "named": true }, { "type": "parens", "named": true }, { "type": "prefix_id", "named": true }, { "type": "prefix_list", "named": true }, { "type": "prefix_tuple", "named": true }, { "type": "prefix_unboxed_sum", "named": true }, { "type": "prefix_unboxed_tuple", "named": true }, { "type": "promoted", "named": true }, { "type": "qualified", "named": true }, { "type": "quasiquote", "named": true }, { "type": "splice", "named": true }, { "type": "star", "named": true }, { "type": "tuple", "named": true }, { "type": "unboxed_sum", "named": true }, { "type": "unboxed_tuple", "named": true }, { "type": "unboxed_unit", "named": true }, { "type": "unit", "named": true }, { "type": "variable", "named": true }, { "type": "wildcard", "named": true } ] }, { "type": "type_param", "named": true, "subtypes": [ { "type": "invisible", "named": true }, { "type": "parens", "named": true }, { "type": "variable", "named": true }, { "type": "wildcard", "named": true } ] }, { "type": "(#", "named": false, "fields": {} }, { "type": "abstract_family", "named": true, "fields": {} }, { "type": "alternative", "named": true, "fields": { "binds": { "multiple": false, "required": false, "types": [ { "type": "local_binds", "named": true } ] }, "match": { "multiple": true, "required": true, "types": [ { "type": "match", "named": true } ] }, "pattern": { "multiple": false, "required": false, "types": [ { "type": "pattern", "named": true }, { "type": "signature", "named": true } ] }, "patterns": { "multiple": false, "required": false, "types": [ { "type": "patterns", "named": true } ] } } }, { "type": "alternatives", "named": true, "fields": { "alternative": { "multiple": true, "required": false, "types": [ { "type": "alternative", "named": true } ] } } }, { "type": "annotated", "named": true, "fields": { "kind": { "multiple": false, "required": true, "types": [ { "type": "quantified_type", "named": true } ] } }, "children": { "multiple": false, "required": true, "types": [ { "type": "type_param", "named": true } ] } }, { "type": "apply", "named": true, "fields": { "argument": { "multiple": false, "required": true, "types": [ { "type": "explicit_type", "named": true }, { "type": "expression", "named": true }, { "type": "kind_application", "named": true }, { "type": "pattern", "named": true }, { "type": "type", "named": true }, { "type": "type_application", "named": true }, { "type": "type_binder", "named": true } ] }, "constructor": { "multiple": false, "required": false, "types": [ { "type": "constraint", "named": true }, { "type": "type", "named": true } ] }, "function": { "multiple": false, "required": false, "types": [ { "type": "expression", "named": true }, { "type": "pattern", "named": true } ] } } }, { "type": "arithmetic_sequence", "named": true, "fields": { "from": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] }, "step": { "multiple": false, "required": false, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] }, "to": { "multiple": false, "required": false, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] } } }, { "type": "as", "named": true, "fields": { "bind": { "multiple": false, "required": true, "types": [ { "type": "variable", "named": true } ] }, "pattern": { "multiple": false, "required": true, "types": [ { "type": "pattern", "named": true } ] } } }, { "type": "associated_type", "named": true, "fields": { "namespace": { "multiple": false, "required": true, "types": [ { "type": "type", "named": false } ] }, "type": { "multiple": false, "required": true, "types": [ { "type": "name", "named": true }, { "type": "qualified", "named": true } ] } } }, { "type": "bind", "named": true, "fields": { "arrow": { "multiple": false, "required": false, "types": [ { "type": "<-", "named": false }, { "type": "←", "named": false } ] }, "binds": { "multiple": false, "required": false, "types": [ { "type": "local_binds", "named": true } ] }, "expression": { "multiple": false, "required": false, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] }, "implicit": { "multiple": false, "required": false, "types": [ { "type": "implicit_variable", "named": true } ] }, "match": { "multiple": true, "required": false, "types": [ { "type": "match", "named": true } ] }, "name": { "multiple": false, "required": false, "types": [ { "type": "prefix_id", "named": true }, { "type": "variable", "named": true } ] }, "pattern": { "multiple": false, "required": false, "types": [ { "type": "pattern", "named": true }, { "type": "signature", "named": true } ] } } }, { "type": "binding_list", "named": true, "fields": { "name": { "multiple": true, "required": true, "types": [ { "type": "constructor", "named": true }, { "type": "prefix_id", "named": true }, { "type": "variable", "named": true } ] } } }, { "type": "boolean", "named": true, "fields": {}, "children": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] } }, { "type": "case", "named": true, "fields": { "alternatives": { "multiple": false, "required": false, "types": [ { "type": "alternatives", "named": true } ] } }, "children": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] } }, { "type": "children", "named": true, "fields": { "element": { "multiple": true, "required": false, "types": [ { "type": "all_names", "named": true }, { "type": "associated_type", "named": true }, { "type": "constructor", "named": true }, { "type": "prefix_id", "named": true }, { "type": "qualified", "named": true }, { "type": "variable", "named": true } ] } } }, { "type": "class", "named": true, "fields": { "context": { "multiple": false, "required": false, "types": [ { "type": "context", "named": true } ] }, "declarations": { "multiple": false, "required": false, "types": [ { "type": "class_declarations", "named": true } ] }, "fundeps": { "multiple": false, "required": false, "types": [ { "type": "fundeps", "named": true } ] }, "name": { "multiple": false, "required": false, "types": [ { "type": "name", "named": true }, { "type": "prefix_id", "named": true }, { "type": "prefix_list", "named": true }, { "type": "unit", "named": true } ] }, "patterns": { "multiple": false, "required": false, "types": [ { "type": "type_params", "named": true } ] } }, "children": { "multiple": false, "required": false, "types": [ { "type": "infix", "named": true }, { "type": "parens", "named": true } ] } }, { "type": "class_declarations", "named": true, "fields": { "declaration": { "multiple": true, "required": false, "types": [ { "type": "class_decl", "named": true } ] } } }, { "type": "conditional", "named": true, "fields": { "else": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] }, "if": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] }, "then": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] } } }, { "type": "constructor_operator", "named": true, "fields": {} }, { "type": "constructor_synonym", "named": true, "fields": { "binds": { "multiple": false, "required": false, "types": [ { "type": "local_binds", "named": true } ] }, "implicit": { "multiple": false, "required": false, "types": [ { "type": "implicit_variable", "named": true } ] }, "match": { "multiple": true, "required": true, "types": [ { "type": "match", "named": true } ] }, "name": { "multiple": false, "required": false, "types": [ { "type": "prefix_id", "named": true }, { "type": "variable", "named": true } ] }, "pattern": { "multiple": false, "required": false, "types": [ { "type": "pattern", "named": true }, { "type": "signature", "named": true } ] } } }, { "type": "constructor_synonyms", "named": true, "fields": {}, "children": { "multiple": true, "required": false, "types": [ { "type": "constructor_synonym", "named": true } ] } }, { "type": "context", "named": true, "fields": { "arrow": { "multiple": false, "required": true, "types": [ { "type": "=>", "named": false }, { "type": "⇒", "named": false } ] }, "constraint": { "multiple": false, "required": false, "types": [ { "type": "constraints", "named": true } ] }, "context": { "multiple": false, "required": true, "types": [ { "type": "constraint", "named": true } ] }, "type": { "multiple": false, "required": false, "types": [ { "type": "quantified_type", "named": true } ] } } }, { "type": "data_constructor", "named": true, "fields": { "constructor": { "multiple": false, "required": true, "types": [ { "type": "infix", "named": true }, { "type": "prefix", "named": true }, { "type": "record", "named": true }, { "type": "special", "named": true } ] }, "context": { "multiple": false, "required": false, "types": [ { "type": "context", "named": true } ] }, "forall": { "multiple": false, "required": false, "types": [ { "type": "forall", "named": true }, { "type": "forall_required", "named": true } ] } } }, { "type": "data_constructors", "named": true, "fields": { "constructor": { "multiple": true, "required": true, "types": [ { "type": "data_constructor", "named": true } ] } } }, { "type": "data_family", "named": true, "fields": { "kind": { "multiple": false, "required": false, "types": [ { "type": "quantified_type", "named": true } ] }, "name": { "multiple": false, "required": false, "types": [ { "type": "name", "named": true }, { "type": "prefix_id", "named": true }, { "type": "prefix_list", "named": true }, { "type": "unit", "named": true } ] }, "patterns": { "multiple": false, "required": false, "types": [ { "type": "type_params", "named": true } ] } }, "children": { "multiple": false, "required": false, "types": [ { "type": "infix", "named": true }, { "type": "parens", "named": true } ] } }, { "type": "data_instance", "named": true, "fields": {}, "children": { "multiple": false, "required": true, "types": [ { "type": "data_type", "named": true }, { "type": "newtype", "named": true } ] } }, { "type": "data_type", "named": true, "fields": { "constructors": { "multiple": false, "required": false, "types": [ { "type": "data_constructors", "named": true }, { "type": "gadt_constructors", "named": true } ] }, "context": { "multiple": false, "required": false, "types": [ { "type": "context", "named": true } ] }, "deriving": { "multiple": true, "required": false, "types": [ { "type": "deriving", "named": true } ] }, "forall": { "multiple": false, "required": false, "types": [ { "type": "forall", "named": true }, { "type": "forall_required", "named": true } ] }, "kind": { "multiple": false, "required": false, "types": [ { "type": "quantified_type", "named": true } ] }, "name": { "multiple": false, "required": false, "types": [ { "type": "name", "named": true }, { "type": "prefix_id", "named": true }, { "type": "prefix_list", "named": true }, { "type": "qualified", "named": true }, { "type": "unit", "named": true } ] }, "patterns": { "multiple": false, "required": false, "types": [ { "type": "type_params", "named": true }, { "type": "type_patterns", "named": true } ] } }, "children": { "multiple": false, "required": false, "types": [ { "type": "infix", "named": true }, { "type": "parens", "named": true } ] } }, { "type": "declarations", "named": true, "fields": {}, "children": { "multiple": true, "required": true, "types": [ { "type": "declaration", "named": true }, { "type": "import", "named": true } ] } }, { "type": "default_signature", "named": true, "fields": { "signature": { "multiple": false, "required": true, "types": [ { "type": "signature", "named": true } ] } } }, { "type": "default_types", "named": true, "fields": { "type": { "multiple": true, "required": false, "types": [ { "type": "quantified_type", "named": true }, { "type": "signature", "named": true } ] } } }, { "type": "deriving", "named": true, "fields": { "classes": { "multiple": false, "required": true, "types": [ { "type": "constraint", "named": true } ] }, "strategy": { "multiple": false, "required": false, "types": [ { "type": "deriving_strategy", "named": true } ] }, "via": { "multiple": false, "required": false, "types": [ { "type": "via", "named": true } ] } } }, { "type": "deriving_instance", "named": true, "fields": { "context": { "multiple": false, "required": false, "types": [ { "type": "context", "named": true } ] }, "forall": { "multiple": false, "required": false, "types": [ { "type": "forall", "named": true }, { "type": "forall_required", "named": true } ] }, "name": { "multiple": false, "required": false, "types": [ { "type": "name", "named": true }, { "type": "prefix_id", "named": true }, { "type": "qualified", "named": true } ] }, "patterns": { "multiple": false, "required": false, "types": [ { "type": "type_patterns", "named": true } ] }, "strategy": { "multiple": false, "required": false, "types": [ { "type": "deriving_strategy", "named": true } ] }, "via": { "multiple": false, "required": false, "types": [ { "type": "via", "named": true } ] } }, "children": { "multiple": false, "required": false, "types": [ { "type": "infix", "named": true }, { "type": "parens", "named": true } ] } }, { "type": "deriving_strategy", "named": true, "fields": {} }, { "type": "do", "named": true, "fields": { "statement": { "multiple": true, "required": false, "types": [ { "type": "statement", "named": true } ] } }, "children": { "multiple": false, "required": false, "types": [ { "type": "do_module", "named": true } ] } }, { "type": "do_module", "named": true, "fields": { "id": { "multiple": false, "required": true, "types": [ { "type": "do", "named": false }, { "type": "mdo", "named": false } ] }, "module": { "multiple": false, "required": true, "types": [ { "type": "module", "named": true } ] } } }, { "type": "empty_list", "named": true, "fields": {} }, { "type": "entity", "named": true, "fields": {}, "children": { "multiple": false, "required": true, "types": [ { "type": "string", "named": true } ] } }, { "type": "equation", "named": true, "fields": { "constructors": { "multiple": false, "required": false, "types": [ { "type": "constructor_synonyms", "named": true } ] }, "forall": { "multiple": false, "required": false, "types": [ { "type": "forall", "named": true }, { "type": "forall_required", "named": true } ] }, "name": { "multiple": false, "required": false, "types": [ { "type": "name", "named": true }, { "type": "prefix_id", "named": true }, { "type": "qualified", "named": true } ] }, "pattern": { "multiple": false, "required": false, "types": [ { "type": "pattern", "named": true }, { "type": "signature", "named": true } ] }, "patterns": { "multiple": false, "required": false, "types": [ { "type": "type_patterns", "named": true } ] }, "synonym": { "multiple": false, "required": false, "types": [ { "type": "pattern", "named": true } ] } }, "children": { "multiple": true, "required": false, "types": [ { "type": "infix", "named": true }, { "type": "parens", "named": true }, { "type": "quantified_type", "named": true } ] } }, { "type": "equations", "named": true, "fields": { "equation": { "multiple": true, "required": false, "types": [ { "type": "equation", "named": true } ] } } }, { "type": "exp", "named": true, "fields": {}, "children": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] } }, { "type": "explicit_type", "named": true, "fields": { "type": { "multiple": false, "required": true, "types": [ { "type": "type", "named": true } ] } } }, { "type": "export", "named": true, "fields": { "children": { "multiple": false, "required": false, "types": [ { "type": "children", "named": true } ] }, "namespace": { "multiple": false, "required": false, "types": [ { "type": "namespace", "named": true } ] }, "operator": { "multiple": false, "required": false, "types": [ { "type": "prefix_id", "named": true } ] }, "type": { "multiple": false, "required": false, "types": [ { "type": "name", "named": true }, { "type": "qualified", "named": true } ] }, "variable": { "multiple": false, "required": false, "types": [ { "type": "qualified", "named": true }, { "type": "variable", "named": true } ] } } }, { "type": "exports", "named": true, "fields": { "export": { "multiple": true, "required": false, "types": [ { "type": "export", "named": true } ] } }, "children": { "multiple": true, "required": false, "types": [ { "type": "module_export", "named": true } ] } }, { "type": "field", "named": true, "fields": { "name": { "multiple": true, "required": false, "types": [ { "type": "field_name", "named": true } ] }, "parameter": { "multiple": false, "required": false, "types": [ { "type": "lazy_field", "named": true }, { "type": "quantified_type", "named": true }, { "type": "strict_field", "named": true } ] }, "type": { "multiple": false, "required": false, "types": [ { "type": "lazy_field", "named": true }, { "type": "quantified_type", "named": true }, { "type": "strict_field", "named": true } ] } }, "children": { "multiple": false, "required": false, "types": [ { "type": "type", "named": true } ] } }, { "type": "field_name", "named": true, "fields": {}, "children": { "multiple": false, "required": true, "types": [ { "type": "variable", "named": true } ] } }, { "type": "field_path", "named": true, "fields": { "field": { "multiple": false, "required": true, "types": [ { "type": "field_name", "named": true }, { "type": "qualified", "named": true } ] }, "subfield": { "multiple": true, "required": true, "types": [ { "type": "field_name", "named": true } ] } } }, { "type": "field_pattern", "named": true, "fields": { "field": { "multiple": false, "required": false, "types": [ { "type": "field_name", "named": true }, { "type": "qualified", "named": true } ] }, "pattern": { "multiple": false, "required": false, "types": [ { "type": "pattern", "named": true }, { "type": "signature", "named": true }, { "type": "view_pattern", "named": true } ] } }, "children": { "multiple": false, "required": false, "types": [ { "type": "wildcard", "named": true } ] } }, { "type": "field_update", "named": true, "fields": { "expression": { "multiple": false, "required": false, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] }, "field": { "multiple": false, "required": false, "types": [ { "type": "field_name", "named": true }, { "type": "field_path", "named": true }, { "type": "qualified", "named": true } ] } }, "children": { "multiple": false, "required": false, "types": [ { "type": "wildcard", "named": true } ] } }, { "type": "fields", "named": true, "fields": { "field": { "multiple": true, "required": false, "types": [ { "type": "field", "named": true } ] } } }, { "type": "fixity", "named": true, "fields": { "associativity": { "multiple": false, "required": true, "types": [ { "type": "infix", "named": false }, { "type": "infixl", "named": false }, { "type": "infixr", "named": false } ] }, "operator": { "multiple": true, "required": true, "types": [ { "type": ",", "named": false }, { "type": "constructor_operator", "named": true }, { "type": "infix_id", "named": true }, { "type": "operator", "named": true } ] }, "precedence": { "multiple": false, "required": false, "types": [ { "type": "integer", "named": true } ] } } }, { "type": "forall", "named": true, "fields": { "constraint": { "multiple": false, "required": false, "types": [ { "type": "constraints", "named": true } ] }, "quantifier": { "multiple": false, "required": true, "types": [ { "type": "forall", "named": false }, { "type": "∀", "named": false } ] }, "type": { "multiple": false, "required": false, "types": [ { "type": "quantified_type", "named": true } ] }, "variables": { "multiple": false, "required": false, "types": [ { "type": "quantified_variables", "named": true } ] } } }, { "type": "forall_required", "named": true, "fields": { "quantifier": { "multiple": false, "required": true, "types": [ { "type": "forall", "named": false }, { "type": "∀", "named": false } ] }, "type": { "multiple": false, "required": false, "types": [ { "type": "quantified_type", "named": true } ] }, "variables": { "multiple": false, "required": false, "types": [ { "type": "quantified_variables", "named": true } ] } } }, { "type": "foreign_export", "named": true, "fields": { "calling_convention": { "multiple": false, "required": true, "types": [ { "type": "calling_convention", "named": true } ] }, "entity": { "multiple": false, "required": false, "types": [ { "type": "entity", "named": true } ] }, "signature": { "multiple": false, "required": true, "types": [ { "type": "signature", "named": true } ] } } }, { "type": "foreign_import", "named": true, "fields": { "calling_convention": { "multiple": false, "required": true, "types": [ { "type": "calling_convention", "named": true } ] }, "entity": { "multiple": false, "required": false, "types": [ { "type": "entity", "named": true } ] }, "safety": { "multiple": false, "required": false, "types": [ { "type": "safety", "named": true } ] }, "signature": { "multiple": false, "required": true, "types": [ { "type": "signature", "named": true } ] } } }, { "type": "function", "named": true, "fields": { "arrow": { "multiple": false, "required": false, "types": [ { "type": "->", "named": false }, { "type": "→", "named": false } ] }, "binds": { "multiple": false, "required": false, "types": [ { "type": "local_binds", "named": true } ] }, "match": { "multiple": true, "required": false, "types": [ { "type": "match", "named": true } ] }, "name": { "multiple": false, "required": false, "types": [ { "type": "prefix_id", "named": true }, { "type": "variable", "named": true } ] }, "parameter": { "multiple": false, "required": false, "types": [ { "type": "lazy_field", "named": true }, { "type": "quantified_type", "named": true }, { "type": "strict_field", "named": true } ] }, "parens": { "multiple": false, "required": false, "types": [ { "type": "function_head_parens", "named": true } ] }, "patterns": { "multiple": false, "required": false, "types": [ { "type": "patterns", "named": true } ] }, "result": { "multiple": false, "required": false, "types": [ { "type": "quantified_type", "named": true } ] } }, "children": { "multiple": false, "required": false, "types": [ { "type": "infix", "named": true } ] } }, { "type": "function_head_parens", "named": true, "fields": { "name": { "multiple": false, "required": false, "types": [ { "type": "prefix_id", "named": true }, { "type": "variable", "named": true } ] }, "parens": { "multiple": false, "required": false, "types": [ { "type": "function_head_parens", "named": true } ] }, "patterns": { "multiple": false, "required": false, "types": [ { "type": "patterns", "named": true } ] } }, "children": { "multiple": false, "required": false, "types": [ { "type": "infix", "named": true } ] } }, { "type": "fundep", "named": true, "fields": { "determined": { "multiple": true, "required": true, "types": [ { "type": "variable", "named": true } ] }, "matched": { "multiple": true, "required": true, "types": [ { "type": "variable", "named": true } ] } } }, { "type": "fundeps", "named": true, "fields": { "fundep": { "multiple": true, "required": true, "types": [ { "type": "fundep", "named": true } ] } } }, { "type": "gadt_constructor", "named": true, "fields": { "context": { "multiple": false, "required": false, "types": [ { "type": "context", "named": true } ] }, "forall": { "multiple": false, "required": false, "types": [ { "type": "forall", "named": true }, { "type": "forall_required", "named": true } ] }, "name": { "multiple": false, "required": false, "types": [ { "type": "constructor", "named": true }, { "type": "prefix_id", "named": true } ] }, "names": { "multiple": false, "required": false, "types": [ { "type": "binding_list", "named": true } ] }, "type": { "multiple": false, "required": true, "types": [ { "type": "prefix", "named": true }, { "type": "record", "named": true } ] } } }, { "type": "gadt_constructors", "named": true, "fields": { "constructor": { "multiple": true, "required": false, "types": [ { "type": "gadt_constructor", "named": true } ] } } }, { "type": "generator", "named": true, "fields": { "arrow": { "multiple": false, "required": true, "types": [ { "type": "<-", "named": false }, { "type": "←", "named": false } ] }, "expression": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] }, "pattern": { "multiple": false, "required": true, "types": [ { "type": "pattern", "named": true }, { "type": "signature", "named": true } ] } } }, { "type": "group", "named": true, "fields": { "classifier": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] }, "key": { "multiple": false, "required": false, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] } } }, { "type": "guards", "named": true, "fields": { "guard": { "multiple": true, "required": true, "types": [ { "type": "guard", "named": true } ] } } }, { "type": "haskell", "named": true, "root": true, "fields": { "declarations": { "multiple": false, "required": false, "types": [ { "type": "declarations", "named": true } ] }, "imports": { "multiple": false, "required": false, "types": [ { "type": "imports", "named": true } ] } }, "children": { "multiple": false, "required": false, "types": [ { "type": "header", "named": true } ] } }, { "type": "header", "named": true, "fields": { "exports": { "multiple": false, "required": false, "types": [ { "type": "exports", "named": true } ] }, "module": { "multiple": false, "required": true, "types": [ { "type": "module", "named": true } ] } } }, { "type": "implicit_parameter", "named": true, "fields": { "name": { "multiple": false, "required": true, "types": [ { "type": "implicit_variable", "named": true } ] }, "type": { "multiple": false, "required": true, "types": [ { "type": "quantified_type", "named": true } ] } } }, { "type": "import", "named": true, "fields": { "alias": { "multiple": false, "required": false, "types": [ { "type": "module", "named": true } ] }, "module": { "multiple": false, "required": true, "types": [ { "type": "module", "named": true } ] }, "names": { "multiple": false, "required": false, "types": [ { "type": "import_list", "named": true } ] }, "package": { "multiple": false, "required": false, "types": [ { "type": "import_package", "named": true } ] } } }, { "type": "import_list", "named": true, "fields": { "name": { "multiple": true, "required": false, "types": [ { "type": "import_name", "named": true } ] } } }, { "type": "import_name", "named": true, "fields": { "children": { "multiple": false, "required": false, "types": [ { "type": "children", "named": true } ] }, "namespace": { "multiple": false, "required": false, "types": [ { "type": "namespace", "named": true } ] }, "operator": { "multiple": false, "required": false, "types": [ { "type": "prefix_id", "named": true } ] }, "type": { "multiple": false, "required": false, "types": [ { "type": "name", "named": true }, { "type": "qualified", "named": true } ] }, "variable": { "multiple": false, "required": false, "types": [ { "type": "qualified", "named": true }, { "type": "variable", "named": true } ] } } }, { "type": "imports", "named": true, "fields": { "import": { "multiple": true, "required": true, "types": [ { "type": "import", "named": true } ] } } }, { "type": "inferred", "named": true, "fields": {}, "children": { "multiple": false, "required": true, "types": [ { "type": "annotated", "named": true }, { "type": "type_param", "named": true } ] } }, { "type": "infix", "named": true, "fields": { "left_operand": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true }, { "type": "lazy_field", "named": true }, { "type": "pattern", "named": true }, { "type": "strict_field", "named": true }, { "type": "type", "named": true }, { "type": "type_param", "named": true } ] }, "operator": { "multiple": true, "required": true, "types": [ { "type": "constructor_operator", "named": true }, { "type": "infix_id", "named": true }, { "type": "operator", "named": true }, { "type": "promoted", "named": true }, { "type": "qualified", "named": true } ] }, "right_operand": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true }, { "type": "lazy_field", "named": true }, { "type": "pattern", "named": true }, { "type": "strict_field", "named": true }, { "type": "type", "named": true }, { "type": "type_param", "named": true } ] } } }, { "type": "infix_id", "named": true, "fields": {}, "children": { "multiple": false, "required": true, "types": [ { "type": "constructor", "named": true }, { "type": "name", "named": true }, { "type": "qualified", "named": true }, { "type": "variable", "named": true } ] } }, { "type": "instance", "named": true, "fields": { "context": { "multiple": false, "required": false, "types": [ { "type": "context", "named": true } ] }, "declarations": { "multiple": false, "required": false, "types": [ { "type": "instance_declarations", "named": true } ] }, "forall": { "multiple": false, "required": false, "types": [ { "type": "forall", "named": true }, { "type": "forall_required", "named": true } ] }, "name": { "multiple": false, "required": false, "types": [ { "type": "name", "named": true }, { "type": "prefix_id", "named": true }, { "type": "qualified", "named": true } ] }, "patterns": { "multiple": false, "required": false, "types": [ { "type": "type_patterns", "named": true } ] } }, "children": { "multiple": false, "required": false, "types": [ { "type": "infix", "named": true }, { "type": "parens", "named": true } ] } }, { "type": "instance_declarations", "named": true, "fields": { "declaration": { "multiple": true, "required": false, "types": [ { "type": "instance_decl", "named": true } ] } } }, { "type": "integer", "named": true, "fields": {} }, { "type": "invisible", "named": true, "fields": { "bind": { "multiple": false, "required": true, "types": [ { "type": "type_param", "named": true } ] } } }, { "type": "irrefutable", "named": true, "fields": { "pattern": { "multiple": false, "required": true, "types": [ { "type": "pattern", "named": true } ] } } }, { "type": "kind_application", "named": true, "fields": { "type": { "multiple": false, "required": true, "types": [ { "type": "type", "named": true } ] } } }, { "type": "kind_signature", "named": true, "fields": { "kind": { "multiple": false, "required": true, "types": [ { "type": "quantified_type", "named": true } ] }, "name": { "multiple": false, "required": false, "types": [ { "type": "name", "named": true }, { "type": "prefix_id", "named": true }, { "type": "prefix_list", "named": true }, { "type": "unit", "named": true } ] }, "patterns": { "multiple": false, "required": false, "types": [ { "type": "type_params", "named": true } ] } }, "children": { "multiple": false, "required": false, "types": [ { "type": "infix", "named": true }, { "type": "parens", "named": true } ] } }, { "type": "lambda", "named": true, "fields": { "expression": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] }, "patterns": { "multiple": false, "required": true, "types": [ { "type": "patterns", "named": true } ] } } }, { "type": "lambda_case", "named": true, "fields": { "alternatives": { "multiple": false, "required": false, "types": [ { "type": "alternatives", "named": true } ] } } }, { "type": "lambda_cases", "named": true, "fields": { "alternatives": { "multiple": false, "required": false, "types": [ { "type": "alternatives", "named": true } ] } } }, { "type": "lazy_field", "named": true, "fields": { "type": { "multiple": false, "required": true, "types": [ { "type": "type", "named": true } ] } } }, { "type": "left_section", "named": true, "fields": { "left_operand": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true } ] }, "operator": { "multiple": false, "required": true, "types": [ { "type": "constructor_operator", "named": true }, { "type": "infix_id", "named": true }, { "type": "operator", "named": true }, { "type": "qualified", "named": true } ] } } }, { "type": "let", "named": true, "fields": { "binds": { "multiple": false, "required": false, "types": [ { "type": "local_binds", "named": true } ] } } }, { "type": "let_in", "named": true, "fields": { "binds": { "multiple": false, "required": false, "types": [ { "type": "local_binds", "named": true } ] }, "expression": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] } } }, { "type": "linear_function", "named": true, "fields": { "arrow": { "multiple": false, "required": true, "types": [ { "type": "->", "named": false }, { "type": "->.", "named": false }, { "type": "→", "named": false }, { "type": "⊸", "named": false } ] }, "multiplicity": { "multiple": false, "required": false, "types": [ { "type": "modifier", "named": true } ] }, "parameter": { "multiple": false, "required": true, "types": [ { "type": "lazy_field", "named": true }, { "type": "quantified_type", "named": true }, { "type": "strict_field", "named": true } ] }, "result": { "multiple": false, "required": true, "types": [ { "type": "quantified_type", "named": true } ] } } }, { "type": "list", "named": true, "fields": { "element": { "multiple": true, "required": false, "types": [ { "type": "expression", "named": true }, { "type": "pattern", "named": true }, { "type": "quantified_type", "named": true }, { "type": "signature", "named": true }, { "type": "view_pattern", "named": true } ] } } }, { "type": "list_comprehension", "named": true, "fields": { "expression": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] }, "qualifiers": { "multiple": true, "required": true, "types": [ { "type": "qualifiers", "named": true } ] } } }, { "type": "literal", "named": true, "fields": {}, "children": { "multiple": false, "required": true, "types": [ { "type": "char", "named": true }, { "type": "float", "named": true }, { "type": "integer", "named": true }, { "type": "string", "named": true } ] } }, { "type": "local_binds", "named": true, "fields": { "decl": { "multiple": true, "required": false, "types": [ { "type": "decl", "named": true }, { "type": "fixity", "named": true } ] } } }, { "type": "match", "named": true, "fields": { "expression": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] }, "guards": { "multiple": false, "required": false, "types": [ { "type": "guards", "named": true } ] } } }, { "type": "modifier", "named": true, "fields": {}, "children": { "multiple": false, "required": true, "types": [ { "type": "type", "named": true } ] } }, { "type": "module", "named": true, "fields": {}, "children": { "multiple": true, "required": true, "types": [ { "type": "module_id", "named": true } ] } }, { "type": "module_export", "named": true, "fields": { "module": { "multiple": false, "required": true, "types": [ { "type": "module", "named": true } ] } } }, { "type": "multi_way_if", "named": true, "fields": { "match": { "multiple": true, "required": false, "types": [ { "type": "match", "named": true } ] } } }, { "type": "namespace", "named": true, "fields": {} }, { "type": "negation", "named": true, "fields": { "expression": { "multiple": false, "required": false, "types": [ { "type": "expression", "named": true } ] }, "minus": { "multiple": false, "required": false, "types": [ { "type": "-", "named": false } ] }, "number": { "multiple": false, "required": false, "types": [ { "type": "float", "named": true }, { "type": "integer", "named": true } ] } } }, { "type": "newtype", "named": true, "fields": { "constructor": { "multiple": false, "required": false, "types": [ { "type": "newtype_constructor", "named": true } ] }, "constructors": { "multiple": false, "required": false, "types": [ { "type": "gadt_constructors", "named": true } ] }, "context": { "multiple": false, "required": false, "types": [ { "type": "context", "named": true } ] }, "deriving": { "multiple": true, "required": false, "types": [ { "type": "deriving", "named": true } ] }, "forall": { "multiple": false, "required": false, "types": [ { "type": "forall", "named": true }, { "type": "forall_required", "named": true } ] }, "kind": { "multiple": false, "required": false, "types": [ { "type": "quantified_type", "named": true } ] }, "name": { "multiple": false, "required": false, "types": [ { "type": "name", "named": true }, { "type": "prefix_id", "named": true }, { "type": "prefix_list", "named": true }, { "type": "qualified", "named": true }, { "type": "unit", "named": true } ] }, "patterns": { "multiple": false, "required": false, "types": [ { "type": "type_params", "named": true }, { "type": "type_patterns", "named": true } ] } }, "children": { "multiple": false, "required": false, "types": [ { "type": "infix", "named": true }, { "type": "parens", "named": true } ] } }, { "type": "newtype_constructor", "named": true, "fields": { "field": { "multiple": false, "required": true, "types": [ { "type": "field", "named": true }, { "type": "record", "named": true } ] }, "name": { "multiple": false, "required": true, "types": [ { "type": "constructor", "named": true }, { "type": "prefix_id", "named": true } ] } } }, { "type": "operator", "named": true, "fields": {} }, { "type": "parens", "named": true, "fields": { "expression": { "multiple": false, "required": false, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] }, "kind": { "multiple": false, "required": false, "types": [ { "type": "quantified_type", "named": true } ] }, "name": { "multiple": false, "required": false, "types": [ { "type": "name", "named": true }, { "type": "prefix_id", "named": true }, { "type": "prefix_list", "named": true }, { "type": "qualified", "named": true }, { "type": "unit", "named": true } ] }, "pattern": { "multiple": false, "required": false, "types": [ { "type": "pattern", "named": true }, { "type": "signature", "named": true }, { "type": "view_pattern", "named": true } ] }, "patterns": { "multiple": false, "required": false, "types": [ { "type": "type_params", "named": true }, { "type": "type_patterns", "named": true } ] }, "type": { "multiple": false, "required": false, "types": [ { "type": "quantified_type", "named": true }, { "type": "signature", "named": true } ] } }, "children": { "multiple": false, "required": false, "types": [ { "type": "annotated", "named": true }, { "type": "constraints", "named": true }, { "type": "infix", "named": true }, { "type": "type_param", "named": true } ] } }, { "type": "pattern_guard", "named": true, "fields": { "arrow": { "multiple": false, "required": true, "types": [ { "type": "<-", "named": false }, { "type": "←", "named": false } ] }, "expression": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] }, "pattern": { "multiple": false, "required": true, "types": [ { "type": "pattern", "named": true }, { "type": "signature", "named": true } ] } } }, { "type": "pattern_synonym", "named": true, "fields": {}, "children": { "multiple": false, "required": true, "types": [ { "type": "equation", "named": true }, { "type": "signature", "named": true } ] } }, { "type": "patterns", "named": true, "fields": {}, "children": { "multiple": true, "required": true, "types": [ { "type": "explicit_type", "named": true }, { "type": "pattern", "named": true }, { "type": "type_binder", "named": true } ] } }, { "type": "prefix", "named": true, "fields": { "field": { "multiple": true, "required": false, "types": [ { "type": "lazy_field", "named": true }, { "type": "strict_field", "named": true }, { "type": "type", "named": true } ] }, "name": { "multiple": false, "required": false, "types": [ { "type": "constructor", "named": true }, { "type": "prefix_id", "named": true } ] }, "type": { "multiple": false, "required": false, "types": [ { "type": "quantified_type", "named": true } ] } } }, { "type": "prefix_id", "named": true, "fields": {}, "children": { "multiple": false, "required": true, "types": [ { "type": "constructor_operator", "named": true }, { "type": "operator", "named": true }, { "type": "qualified", "named": true } ] } }, { "type": "prefix_list", "named": true, "fields": {} }, { "type": "prefix_tuple", "named": true, "fields": {} }, { "type": "prefix_unboxed_sum", "named": true, "fields": {} }, { "type": "prefix_unboxed_tuple", "named": true, "fields": {} }, { "type": "projection", "named": true, "fields": { "expression": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true } ] }, "field": { "multiple": false, "required": true, "types": [ { "type": "field_name", "named": true } ] } } }, { "type": "projection_selector", "named": true, "fields": { "field": { "multiple": true, "required": true, "types": [ { "type": "variable", "named": true } ] } } }, { "type": "promoted", "named": true, "fields": {}, "children": { "multiple": false, "required": true, "types": [ { "type": "constructor", "named": true }, { "type": "constructor_operator", "named": true }, { "type": "empty_list", "named": true }, { "type": "infix_id", "named": true }, { "type": "list", "named": true }, { "type": "operator", "named": true }, { "type": "prefix_id", "named": true }, { "type": "prefix_tuple", "named": true }, { "type": "qualified", "named": true }, { "type": "tuple", "named": true }, { "type": "unit", "named": true } ] } }, { "type": "qualified", "named": true, "fields": { "id": { "multiple": false, "required": true, "types": [ { "type": "constructor", "named": true }, { "type": "constructor_operator", "named": true }, { "type": "field_name", "named": true }, { "type": "name", "named": true }, { "type": "operator", "named": true }, { "type": "variable", "named": true } ] }, "module": { "multiple": false, "required": true, "types": [ { "type": "module", "named": true } ] } } }, { "type": "qualifiers", "named": true, "fields": { "qualifier": { "multiple": true, "required": true, "types": [ { "type": "qualifier", "named": true } ] } } }, { "type": "quantified_variables", "named": true, "fields": {}, "children": { "multiple": true, "required": true, "types": [ { "type": "inferred", "named": true }, { "type": "type_param", "named": true } ] } }, { "type": "quasiquote", "named": true, "fields": { "body": { "multiple": false, "required": false, "types": [ { "type": "quasiquote_body", "named": true } ] }, "quoter": { "multiple": false, "required": true, "types": [ { "type": "quoter", "named": true } ] } } }, { "type": "quote", "named": true, "fields": { "quoter": { "multiple": false, "required": false, "types": [ { "type": "d", "named": false }, { "type": "e", "named": false }, { "type": "p", "named": false }, { "type": "t", "named": false } ] } }, "children": { "multiple": false, "required": false, "types": [ { "type": "quoted_decls", "named": true }, { "type": "quoted_expression", "named": true }, { "type": "quoted_pattern", "named": true }, { "type": "quoted_type", "named": true } ] } }, { "type": "quoted_decls", "named": true, "fields": { "declaration": { "multiple": true, "required": false, "types": [ { "type": "declaration", "named": true } ] } } }, { "type": "quoted_expression", "named": true, "fields": {}, "children": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] } }, { "type": "quoted_pattern", "named": true, "fields": {}, "children": { "multiple": false, "required": true, "types": [ { "type": "pattern", "named": true }, { "type": "signature", "named": true } ] } }, { "type": "quoted_type", "named": true, "fields": {}, "children": { "multiple": false, "required": true, "types": [ { "type": "quantified_type", "named": true }, { "type": "signature", "named": true } ] } }, { "type": "quoter", "named": true, "fields": {}, "children": { "multiple": false, "required": true, "types": [ { "type": "qualified", "named": true }, { "type": "variable", "named": true } ] } }, { "type": "rec", "named": true, "fields": { "statement": { "multiple": true, "required": false, "types": [ { "type": "statement", "named": true } ] } } }, { "type": "record", "named": true, "fields": { "arrow": { "multiple": true, "required": false, "types": [ { "type": "->", "named": false }, { "type": "→", "named": false } ] }, "constructor": { "multiple": false, "required": false, "types": [ { "type": "pattern", "named": true } ] }, "expression": { "multiple": false, "required": false, "types": [ { "type": "expression", "named": true } ] }, "field": { "multiple": true, "required": false, "types": [ { "type": "field", "named": true }, { "type": "field_pattern", "named": true }, { "type": "field_update", "named": true } ] }, "fields": { "multiple": false, "required": false, "types": [ { "type": "fields", "named": true } ] }, "name": { "multiple": false, "required": false, "types": [ { "type": "constructor", "named": true } ] }, "type": { "multiple": false, "required": false, "types": [ { "type": "quantified_type", "named": true } ] } } }, { "type": "right_section", "named": true, "fields": { "right_operand": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true } ] } }, "children": { "multiple": false, "required": true, "types": [ { "type": "constructor_operator", "named": true }, { "type": "infix_id", "named": true }, { "type": "operator", "named": true }, { "type": "qualified", "named": true } ] } }, { "type": "role_annotation", "named": true, "fields": { "role": { "multiple": true, "required": true, "types": [ { "type": "type_role", "named": true } ] }, "type": { "multiple": false, "required": true, "types": [ { "type": "name", "named": true }, { "type": "prefix_id", "named": true }, { "type": "qualified", "named": true } ] } } }, { "type": "signature", "named": true, "fields": { "constraint": { "multiple": false, "required": false, "types": [ { "type": "constraints", "named": true } ] }, "expression": { "multiple": false, "required": false, "types": [ { "type": "expression", "named": true } ] }, "kind": { "multiple": false, "required": false, "types": [ { "type": "quantified_type", "named": true } ] }, "name": { "multiple": false, "required": false, "types": [ { "type": "prefix_id", "named": true }, { "type": "variable", "named": true } ] }, "names": { "multiple": false, "required": false, "types": [ { "type": "binding_list", "named": true } ] }, "pattern": { "multiple": false, "required": false, "types": [ { "type": "pattern", "named": true } ] }, "synonym": { "multiple": false, "required": false, "types": [ { "type": "binding_list", "named": true }, { "type": "constructor", "named": true }, { "type": "prefix_id", "named": true } ] }, "type": { "multiple": false, "required": false, "types": [ { "type": "quantified_type", "named": true } ] } } }, { "type": "special", "named": true, "fields": {}, "children": { "multiple": false, "required": true, "types": [ { "type": "empty_list", "named": true }, { "type": "tuple", "named": true }, { "type": "unboxed_sum", "named": true }, { "type": "unboxed_tuple", "named": true }, { "type": "unboxed_unit", "named": true }, { "type": "unit", "named": true } ] } }, { "type": "splice", "named": true, "fields": { "expression": { "multiple": false, "required": true, "types": [ { "type": "constructor", "named": true }, { "type": "implicit_variable", "named": true }, { "type": "label", "named": true }, { "type": "literal", "named": true }, { "type": "parens", "named": true }, { "type": "prefix_id", "named": true }, { "type": "qualified", "named": true }, { "type": "variable", "named": true } ] } } }, { "type": "star", "named": true, "fields": {} }, { "type": "strict", "named": true, "fields": { "pattern": { "multiple": false, "required": true, "types": [ { "type": "pattern", "named": true } ] } } }, { "type": "strict_field", "named": true, "fields": { "type": { "multiple": false, "required": true, "types": [ { "type": "type", "named": true } ] } } }, { "type": "th_quoted_name", "named": true, "fields": { "name": { "multiple": false, "required": false, "types": [ { "type": "constructor", "named": true }, { "type": "prefix_id", "named": true }, { "type": "qualified", "named": true }, { "type": "variable", "named": true } ] }, "type": { "multiple": false, "required": false, "types": [ { "type": "type", "named": true } ] } } }, { "type": "top_splice", "named": true, "fields": {}, "children": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true } ] } }, { "type": "transform", "named": true, "fields": { "key": { "multiple": false, "required": false, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] }, "transformation": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] } } }, { "type": "tuple", "named": true, "fields": { "element": { "multiple": true, "required": false, "types": [ { "type": "expression", "named": true }, { "type": "pattern", "named": true }, { "type": "quantified_type", "named": true }, { "type": "signature", "named": true }, { "type": "view_pattern", "named": true } ] } }, "children": { "multiple": true, "required": false, "types": [ { "type": "constraints", "named": true } ] } }, { "type": "type_application", "named": true, "fields": { "type": { "multiple": false, "required": true, "types": [ { "type": "type", "named": true } ] } } }, { "type": "type_binder", "named": true, "fields": { "type": { "multiple": false, "required": true, "types": [ { "type": "type", "named": true } ] } } }, { "type": "type_family", "named": true, "fields": { "closed_family": { "multiple": false, "required": false, "types": [ { "type": "abstract_family", "named": true }, { "type": "equations", "named": true } ] }, "kind": { "multiple": false, "required": false, "types": [ { "type": "quantified_type", "named": true } ] }, "name": { "multiple": false, "required": false, "types": [ { "type": "name", "named": true }, { "type": "prefix_id", "named": true }, { "type": "prefix_list", "named": true }, { "type": "unit", "named": true } ] }, "patterns": { "multiple": false, "required": false, "types": [ { "type": "type_params", "named": true } ] } }, "children": { "multiple": true, "required": false, "types": [ { "type": "infix", "named": true }, { "type": "parens", "named": true }, { "type": "type_family_injectivity", "named": true }, { "type": "type_family_result", "named": true } ] } }, { "type": "type_family_injectivity", "named": true, "fields": { "determined": { "multiple": true, "required": true, "types": [ { "type": "variable", "named": true } ] }, "result": { "multiple": false, "required": true, "types": [ { "type": "variable", "named": true } ] } } }, { "type": "type_family_result", "named": true, "fields": { "result": { "multiple": false, "required": true, "types": [ { "type": "quantified_type", "named": true } ] } } }, { "type": "type_instance", "named": true, "fields": { "forall": { "multiple": false, "required": false, "types": [ { "type": "forall", "named": true }, { "type": "forall_required", "named": true } ] }, "name": { "multiple": false, "required": false, "types": [ { "type": "name", "named": true }, { "type": "prefix_id", "named": true }, { "type": "qualified", "named": true } ] }, "patterns": { "multiple": false, "required": false, "types": [ { "type": "type_patterns", "named": true } ] } }, "children": { "multiple": true, "required": true, "types": [ { "type": "infix", "named": true }, { "type": "parens", "named": true }, { "type": "quantified_type", "named": true } ] } }, { "type": "type_params", "named": true, "fields": {}, "children": { "multiple": true, "required": true, "types": [ { "type": "type_param", "named": true } ] } }, { "type": "type_patterns", "named": true, "fields": {}, "children": { "multiple": true, "required": true, "types": [ { "type": "kind_application", "named": true }, { "type": "type", "named": true } ] } }, { "type": "type_role", "named": true, "fields": {} }, { "type": "type_synomym", "named": true, "fields": { "name": { "multiple": false, "required": false, "types": [ { "type": "name", "named": true }, { "type": "prefix_id", "named": true }, { "type": "prefix_list", "named": true }, { "type": "unit", "named": true } ] }, "patterns": { "multiple": false, "required": false, "types": [ { "type": "type_params", "named": true } ] }, "type": { "multiple": false, "required": true, "types": [ { "type": "quantified_type", "named": true }, { "type": "signature", "named": true } ] } }, "children": { "multiple": false, "required": false, "types": [ { "type": "infix", "named": true }, { "type": "parens", "named": true } ] } }, { "type": "typed_quote", "named": true, "fields": {}, "children": { "multiple": false, "required": false, "types": [ { "type": "quoted_expression", "named": true } ] } }, { "type": "unboxed_sum", "named": true, "fields": { "element": { "multiple": true, "required": true, "types": [ { "type": "expression", "named": true }, { "type": "pattern", "named": true }, { "type": "quantified_type", "named": true }, { "type": "signature", "named": true }, { "type": "view_pattern", "named": true } ] } } }, { "type": "unboxed_tuple", "named": true, "fields": { "element": { "multiple": true, "required": true, "types": [ { "type": "expression", "named": true }, { "type": "pattern", "named": true }, { "type": "quantified_type", "named": true }, { "type": "signature", "named": true }, { "type": "view_pattern", "named": true } ] } } }, { "type": "unboxed_unit", "named": true, "fields": {} }, { "type": "unit", "named": true, "fields": {} }, { "type": "via", "named": true, "fields": { "type": { "multiple": false, "required": true, "types": [ { "type": "quantified_type", "named": true } ] } } }, { "type": "view_pattern", "named": true, "fields": { "expression": { "multiple": false, "required": true, "types": [ { "type": "expression", "named": true }, { "type": "signature", "named": true } ] }, "pattern": { "multiple": false, "required": true, "types": [ { "type": "pattern", "named": true }, { "type": "signature", "named": true }, { "type": "view_pattern", "named": true } ] } } }, { "type": "wildcard", "named": true, "fields": {} }, { "type": "!", "named": false }, { "type": "#", "named": false }, { "type": "#)", "named": false }, { "type": "$", "named": false }, { "type": "$$", "named": false }, { "type": "%", "named": false }, { "type": "'", "named": false }, { "type": "''", "named": false }, { "type": "(", "named": false }, { "type": "(#", "named": false }, { "type": ")", "named": false }, { "type": "*", "named": false }, { "type": ",", "named": false }, { "type": "-", "named": false }, { "type": "->", "named": false }, { "type": "->.", "named": false }, { "type": ".", "named": false }, { "type": "..", "named": false }, { "type": "1", "named": false }, { "type": "::", "named": false }, { "type": ";", "named": false }, { "type": "<-", "named": false }, { "type": "=", "named": false }, { "type": "=>", "named": false }, { "type": "@", "named": false }, { "type": "[", "named": false }, { "type": "\\", "named": false }, { "type": "]", "named": false }, { "type": "_", "named": false }, { "type": "`", "named": false }, { "type": "all_names", "named": true }, { "type": "anyclass", "named": false }, { "type": "as", "named": false }, { "type": "by", "named": false }, { "type": "calling_convention", "named": true }, { "type": "case", "named": false }, { "type": "cases", "named": false }, { "type": "char", "named": true }, { "type": "class", "named": false }, { "type": "comment", "named": true }, { "type": "constructor", "named": true }, { "type": "cpp", "named": true }, { "type": "d", "named": false }, { "type": "data", "named": false }, { "type": "default", "named": false }, { "type": "deriving", "named": false }, { "type": "do", "named": false }, { "type": "e", "named": false }, { "type": "else", "named": false }, { "type": "export", "named": false }, { "type": "family", "named": false }, { "type": "float", "named": true }, { "type": "forall", "named": false }, { "type": "foreign", "named": false }, { "type": "group", "named": false }, { "type": "haddock", "named": true }, { "type": "hiding", "named": false }, { "type": "if", "named": false }, { "type": "implicit_variable", "named": true }, { "type": "import", "named": false }, { "type": "import_package", "named": true }, { "type": "in", "named": false }, { "type": "infix", "named": false }, { "type": "infixl", "named": false }, { "type": "infixr", "named": false }, { "type": "instance", "named": false }, { "type": "label", "named": true }, { "type": "let", "named": false }, { "type": "mdo", "named": false }, { "type": "module", "named": false }, { "type": "module_id", "named": true }, { "type": "name", "named": true }, { "type": "newtype", "named": false }, { "type": "nominal", "named": false }, { "type": "of", "named": false }, { "type": "p", "named": false }, { "type": "pattern", "named": false }, { "type": "phantom", "named": false }, { "type": "pragma", "named": true }, { "type": "qualified", "named": false }, { "type": "quasiquote_body", "named": true }, { "type": "rec", "named": false }, { "type": "representational", "named": false }, { "type": "role", "named": false }, { "type": "safety", "named": true }, { "type": "stock", "named": false }, { "type": "string", "named": true }, { "type": "t", "named": false }, { "type": "then", "named": false }, { "type": "type", "named": false }, { "type": "using", "named": false }, { "type": "variable", "named": true }, { "type": "via", "named": false }, { "type": "where", "named": false }, { "type": "{", "named": false }, { "type": "|", "named": false }, { "type": "|]", "named": false }, { "type": "||", "named": false }, { "type": "||]", "named": false }, { "type": "}", "named": false }, { "type": "~", "named": false }, { "type": "←", "named": false }, { "type": "→", "named": false }, { "type": "⇒", "named": false }, { "type": "∀", "named": false }, { "type": "∷", "named": false }, { "type": "⊸", "named": false }, { "type": "★", "named": false }, { "type": "⟦", "named": false }, { "type": "⟧", "named": false } ] ================================================ FILE: src/parser.c ================================================ [File too large to display: 18.9 MB] ================================================ FILE: src/scanner.c ================================================ /** * The scanner is an extension to the built-in lexer that handles cases that are hard or impossible to express with the * high-level grammar rules. * Since Haskell is indentation sensitive and uses parse errors to end layouts, this component has many * responsibilities. * * tree-sitter runs the scanner at every position repeatedly until it fails, after which the built-in lexer consumes one * token. * When the scanner succeeds, it returns the index of a symbol in the `externals` array in `grammar/externals.js`, which * is then processed like other grammar symbols, except that it terminates any conflict branches in which the symbol * isn't valid. * The scanner's state is persisted and passed into the next run, but it is discarded when the scanner fails, i.e. when * it yields control back to the built-in lexer. * * The high-level workflow of the scanner consists of three distinct modes. * When the first character after whitespace is a newline, the scanner starts newline lookahead, otherwise it processes * an interior position. * If the state indicates that the previous run performed newline lookahead, it enters newline processing mode. * * In interior mode, a single lexing pass is performed. * * Such a pass consists of two steps: * * In the first step, the scanner identifies the immediate token by branching on the first character after whitespace * and examining different conditions to select one of the variants of the enum `Lexed`, which enumerates all known, * interesting, situations. * The position of the lexer may be advanced in the process to look at subsequent characters. * To avoid having to arrange different parts of the logic according to how many characters have been consumed, * lookahead is written to an array in the transient state on demand, so that each component can specify the index * relative to the position at the beginning of the run (modulo whitespace). * The entry point for this step is the function `lex`. * * The second step is different for each mode. * In interior mode, the `Lexed` token determines which symbol to return to the grammar based on the current state, like * layout contexts and valid symbols. * Most symbols do not contain any text, but only act as conditions in the grammar, but for symbolic operators, CPP, * comments, pragmas, and quasiquotes, the lexer is advanced to the end of the token and `mark_end` is called to * communicate the range to tree-sitter. * * In newline lookahead mode, the scanner performs repeated lexing passes until it encounters a `Lexed` token that is * not CPP or a comment. * In the second step of each pass, the token determines whether to terminate and/or which flags to set in the state to * guide processing in the next run. * If the lookahead loop has only made a single lexing pass that did not consume any characters of the following token * (because the first character did not match any of the conditions for lexing that require more lookahead), the scanner * switches to newline processing mode directly; otherwise it terminates the run after storing the newline information * in the persistent state. * This is possible by succeeding with the symbol `UPDATE`, which is mapped to newline in `externals`. * tree-sitter does not create a node in the parse tree for this symbol if `mark_end` wasn't called after consuming * lookahead, and immediately calls the scanner again at the same position. * * In either case, the scanner ends up in newline processing mode, in which it performs a series of highly * order-sensitive steps based on the data collected in lookahead mode, potentially returning multiple symbols in * successive runs until none of the newline-related conditions match. * This procedure ensures that nested layouts are terminated at the earliest position instead of extending over all * subsequent (top-level) whitespace, comments and CPP up to the next layout element. * Only when all layouts are terminated will the scanner process the final `Lexed` token that it stored in the state in * lookahead mode, using the same logic as in interior mode, and update the state to disable newline processing for the * next run. */ #include "tree_sitter/alloc.h" #include "tree_sitter/array.h" #include "tree_sitter/parser.h" #include "unicode.h" #include #include #include #define PEEK env->lexer->lookahead #ifdef TREE_SITTER_DEBUG #include #define S_ADVANCE advance_debug(env) #define S_SKIP skip_debug(env) #define MARK(s) mark_debug(env, s) #define dbg(...) do { fprintf(stderr, __VA_ARGS__); } while (0) #else // Move the parser position one character to the right. #define S_ADVANCE advance(env) // Move the parser position one character to the right, treating the consumed character as whitespace. #define S_SKIP env->lexer->advance(env->lexer, true) /** * Instruct the lexer that the current position is the end of the potentially detected symbol, causing the next run to * be started after this character in the success case. * * This is useful if the validity of the detected symbol depends on what follows. */ #define MARK(s) env->lexer->mark_end(env->lexer) #define dbg(...) do {} while (0) #endif // Short circuit a parse step: If the argument expression returns 0, continue; otherwise return its result. // This is used with enums, so casting to unsigned should not cause problems. #define SEQ(expr) do { unsigned res = (unsigned) expr; if (res) return res; } while (0) // -------------------------------------------------------------------------------------------------------- // Symbols // -------------------------------------------------------------------------------------------------------- /** * This enum mirrors the symbols in `externals` in `grammar/externals.js`. * tree-sitter passes an array of booleans to the scanner whose entries are `true` if the symbol at the corresponding * index is valid at the current parser position. */ typedef enum { FAIL, SEMICOLON, START, START_DO, START_CASE, START_IF, START_LET, START_QUOTE, START_EXPLICIT, END, END_EXPLICIT, START_BRACE, END_BRACE, START_TEXP, END_TEXP, WHERE, IN, ARROW, BAR, DERIVING, COMMENT, HADDOCK, CPP, PRAGMA, QQ_START, QQ_BODY, SPLICE, QUAL_DOT, TIGHT_DOT, PREFIX_DOT, DOTDOT, TIGHT_AT, PREFIX_AT, TIGHT_BANG, PREFIX_BANG, TIGHT_TILDE, PREFIX_TILDE, PREFIX_PERCENT, QUALIFIED_OP, LEFT_SECTION_OP, NO_SECTION_OP, MINUS, CONTEXT, INFIX, DATA_INFIX, TYPE_INSTANCE, VARSYM, CONSYM, UPDATE, } Symbol; #ifdef TREE_SITTER_DEBUG static const char *sym_names[] = { "fail", "semicolon", "start", "start_do", "start_case", "start_if", "start_let", "start_quote", "start_explicit", "end", "end_explicit", "start_brace", "end_brace", "start_texp", "end_texp", "where", "in", "arrow", "bar", "deriving", "comment", "haddock", "cpp", "pragma", "qq_start", "qq_body", "splice", "tight_dot", "proj_dot", "prefix_dot", "dotdot", "tight_at", "prefix_at", "tight_bang", "prefix_bang", "tight_tilde", "prefix_tilde", "prefix_percent", "qualified_op", "left_section_op", "no_section_op", "minus", "context", "infix", "data_infix", "type_instance", "varsym", "consym", "update", }; #endif // -------------------------------------------------------------------------------------------------------- // Data // -------------------------------------------------------------------------------------------------------- #ifdef TREE_SITTER_DEBUG typedef Array(int32_t) ParseLine; /** * A vector of lines, persisted across runs, for visualizing the current lexer position and scanner lookahead. */ typedef Array(ParseLine) ParseLines; /** * Info about calls to `mark_end` and how far the lexer has progressed in a run. * Discarded after each run. */ typedef struct { int marked; unsigned marked_line; unsigned start_col; unsigned start_line; unsigned end_col; const char *marked_by; } Debug; Debug debug_new(TSLexer *l) { return (Debug) { .marked = -1, .marked_line = 0, .start_col = l->get_column(l), .start_line = 0, .end_col = 0, .marked_by = "", }; } #endif /** * Different sorts of layout contexts that require special treatment. */ typedef enum { DeclLayout, DoLayout, CaseLayout, LetLayout, QuoteLayout, MultiWayIfLayout, Braces, TExp, ModuleHeader, NoContext, } ContextSort; #ifdef TREE_SITTER_DEBUG static char const *context_names[] = { "decls", "do", "case", "let", "multi_way_if", "quote", "braces", "texp", "module_header", "none", }; #endif /** * The persistent state maintains a stack of layout contexts. * New entries are created when a layout symbol is valid at the current position, and they are removed when the indent * of a line satisfies conditions that depend on the current context sort, or when certain tokens (like `else`) occur. */ typedef struct { ContextSort sort; uint32_t indent; } Context; /** * This enumerates the lookahead tokens that have special meaning in the scanner. */ typedef enum { LNothing, LEof, LWhere, LIn, LThen, LElse, LDeriving, LModule, LUpper, LTick, LSymop, LSymopSpecial, LDotDot, LDotId, LDotSymop, LDotOpen, LDollar, LBang, LTilde, LAt, LPercent, LHash, LBar, LArrow, LCArrow, LTexpCloser, LQuoteClose, LPragma, LBlockComment, LLineComment, LBraceClose, LBraceOpen, LBracketOpen, LUnboxedClose, LSemi, LCppElse, LCpp, } Lexed; #ifdef TREE_SITTER_DEBUG static const char *token_names[] = { "nothing", "eof", "where", "in", "then", "else", "deriving", "module", "upper", "tick", "symop", "symop-special", "dot-dot", "dot-id", "dot-symop", "dot-open", "dollar", "bang", "tilde", "at", "percent", "hash", "bar", "arrow", "ctr", "texp-closer", "quote-close", "pragma", "block-comment", "line-comment", "brace-close", "brace-open", "bracket-open", "unboxed-close", "semi", "cpp-else", "cpp", }; #endif /** * The current newline mode. * `NInit` is set during newline lookahead, and `NProcess` when lookahead has finished. * After processing is complete, the state is reset to `NInactive`. * `NResume` is a special variant that forces newline lookahead mode when a run starts without requiring a newline. * This is used for the beginning of the file and after pragmas (see `pragma`). */ typedef enum { NInactive, NInit, NProcess, NResume, } NewlineState; /** * The two newline modes need to operate across multiple scanner runs and adapt their behavior to the context * established by previous runs, encoded by this persistent state. */ typedef struct { NewlineState state; // The final token encountered after skipping comments and CPP. Lexed end; // The indent of `end`, used to decide layout actions before parsing intermediate extras. uint32_t indent; // When there is no token after extras, we shouldn't start layouts. bool eof; // Prohibit layout semicolons in future runs. bool no_semi; // Prohibit layout semicolons in future runs, but can be relaxed by some actions. // See `explicit_semicolon`. bool skip_semi; // Lookahead has advanced into `end`, so the scanner has to be restarted before processing the newline result. bool unsafe; } Newline; /** * The vector for the layout context stack. */ typedef Array(Context) Contexts; /** * Whenever the lexer is advanced over non-(leading-)whitespace, the consumed character is appended to this vector. * This avoids having to ensure that different components that need to examine multiple lookahead characters have to be * run in the correct order. * Instead, we refer to lookahead by the character's index using the interface described in the section 'Lookahead'. * * For example, the functions `peek0`, `char0`, `char1` operate on the first/second character relative to the start of * the scanner run, and the implementation advances the lexer position when it is necessary. * * The field `offset` can be used to reset relative indexing to the current lexer position. * This is used, for example, in `newline_lookahead`, to perform repeated lexing passes, since `lex` uses the lookahead * interface. * After processing a `Lexed` token, `newline_lookahead` continues seeking ahead after comments and CPP, and when it * encounters the next token, it calls `reset_lookahead` to set `offset` to the current position, ensuring that `lex` * can use `char0` to test the following character. * * The terminology for advancing is: * - "Advance before character C at index N" means "`lexer->lookahead` returns C, but 'Lookahead' does not contain C and * has size N" * - "Advance over character C at index N" means "`lexer->lookahead` returns the character following C, 'Lookahead' * contains C and has size N+1" (or "advance before N+1") * - If the size of 'Lookahead' is already larger than N, and therefore C can be read from the vector, the * postconditions may not hold (when independent steps access lookahead at different indexes) * * Example: * * Assume we are parsing the following line, and the scanner is called right after the `a` in the right-hand side: * * > calc a b = a Library.Math.** b * ^ (lexer position: before the character above the ^, `lexer->lookahead` returns the space) * || 0/0 (content of `data` between bars, empty; `len` after bars, `offset` after slash) * * 'Lookahead' is initialized with `len = 0` and `offset = 0`. * * The full lookahead string (stored in tree-sitter's internals) at this position is ` Library.Math.** b`, and all * _absolute_ indexes point into that string. * Since tree-sitter only exposes the "next" character at a time, indexing requires advancing the lexer and copying * characters to 'Lookahead' on demand. * * An initial `skip_space` advances over the space between `a` and `Lib`, which does not update 'Lookahead'. * * > calc a b = a Library.Math.** b * ^ * || 0/0 * * The uppercase character in `Lib` triggers the detection of qualified operators in `qualified_op`, which repeatedly * lexes module segments and dots. * * The module segment step starts (in `conid`) by checking that the next character is upper case using `peek0` (short * for `peek(0)`), which accesses the _first_ lookahead character – but _first_ is always relative to the current * `offset`. * We call the relative index `rel` and the absolute one `abs = offset + rel`. * Before `Lib`, this translates to `abs = rel = 0`. * * `peek` checks if 'Lookahead' already contains the character for this index (`abs < len`), so it can directly return * the value at `data[abs]`, which fails, since the vector is empty. * Instead, it will fetch the character directly from the tree-sitter lexer. * The lexer provides one character of lookahead outside of 'Lookahead', which is enough for this case. * `peek` is a conservative action, so it will not copy the character to 'Lookahead', and leave the lexer position * unchanged. * * `L` is upper case, so `qualified_op` switches to the next phase: Advancing to the end of the module segment, which * amounts to advancing before the first character that is not an identifier character: * * > advance_while(1, is_inner_id_char) * * This function applies the specified predicate to the character at the specified index. * If that returns `true`, it advances over the character and increments the index. * These steps are repeated until the predicate is `false`. * The index is returned, pointing to the character after the module segment. * * `peek0` doesn't modify lookahead, so the next character is still `L`. * We don't need to validate it again, so the starting index specified to `advance_while` is `1`. * * Let's look at the steps performed by this function in detail. * It starts by accessing the character at the initial index, calling `peek(1)`. * As for the `L` check, this calculates `abs = offset + rel = 0 + 1` and determines that it is smaller than `len`, * again. * However, this time the requested character is the _second_ lookahead character, so `peek` calls `advance_before(1)`, * which calls `advance` as many times as needed to access the character via `lexer->lookahead`, which is * `offset + n - len` times, so _once_ in this case. * The result is that `L` is copied to 'Lookahead' and `lexer->advance` is invoked one time, resulting in this new * state: * * > calc a b = a Library.Math.** b * ^ * || 1/0 * * Now `lexer->lookahead` returns `i`, which `conid` successfully validates as an "inner ID character", so it increments * the index to 2. * `peek(2)` performs the exact same steps as `peek(1)`, as do all subsequent steps until `peek(7)` returns `.`, which * fails the predicate, terminating the loop without advancing and returning 7 from `conid`, with the final state: * * > calc a b = a Library.Math.** b * ^ * || 7/0 * * `qualified_op` now examines the returned index: * If it is 0, the first character was not upper case and there is no module segment at this position, so lexing fails * and the scanner returns control to tree-sitter. * Otherwise, it calls `char_at(7, '.')` to require that the character after the module segment is a dot, with the same * consequences. * * Since our test code meets these conditions, `qualified_op` continues with `reset_lookahead_to(8)`. * This sets `offset` to 8, causing all future lookahead actions that use relative indexes to operate on characters * _after_ this new offset. * Here this is the first character after the dot, `M`. * Note that modifying the offset does not advance the lexer right away, so the lexer position will remain at 7: * * > calc a b = a Library.Math.** b * ^ (zero-based index 7) * || 7/8 * * After a dot, `qualified_op` decides what to do next by determining whether what follows is a symbolic operator by * calling `symop_lookahead`, which uses the same predicate-based function as before, `advance_while(0, symop_char)`. * When that function calls `peek(0)`, the absolute index `offset + 0 = 8` is requested, which is not available, so the * lexer is advanced once: * * > calc a b = a Library.Math.** b * ^ * || 8/8 * * Note that `len == 8` means there are eight characters in 'Lookahead', up to and including the dot, while the index * `offset == 8` refers to the _ninth_ character, `M`. * * `M` is not a symop character, so `qualified_op` restarts the loop and parses the next module segment. * The process is identical to the previous iteration except for the value of `offset`, which causes all steps that * examine relative lookahead with `peek0` and `peek_at` add 8 to each index. * * Once the second dot is parsed, the symop test will succeed after advancing over both asterisks, which satisfies the * termination condition in `qualified_op`, and the scanner run finishes with the final state: * * > calc a b = a Library.Math.** b * ^ * || 15/13 */ typedef struct { int32_t *contents; uint32_t size; uint32_t capacity; uint32_t offset; } Lookahead; /** * The state that is persisted across scanner runs. * * Although 'Lookahead' is always reset when starting a new run, storing it in the state avoids having to allocate and * free the array repeatedly. * Instead we just reset the `len` attribute to 0 and reuse the previous memory. * * REVIEW: Can tree-sitter run the scanner concurrently on multiple nodes in the same file in some situations? */ typedef struct { Contexts contexts; Newline newline; Lookahead lookahead; #ifdef TREE_SITTER_DEBUG ParseLines parse; #endif } State; /** * Transient state and stuff provided by tree-sitter. */ typedef struct { TSLexer *lexer; const bool *symbols; uint32_t symop; State *state; #ifdef TREE_SITTER_DEBUG Debug debug; #endif } Env; static Env env_new(TSLexer *l, const bool * symbols, State *state) { return (Env) { .lexer = l, .symbols = symbols, .symop = 0, .state = state, #ifdef TREE_SITTER_DEBUG .debug = debug_new(l), #endif }; } static void reset_newline(Env *env) { memset(&env->state->newline, 0, sizeof(Newline)); } static bool newline_active(Env *env) { return env->state->newline.state == NInit || env->state->newline.state == NProcess; } static bool newline_init(Env *env) { return env->state->newline.state == NInit; } // -------------------------------------------------------------------------------------------------------- // Lexer interaction // -------------------------------------------------------------------------------------------------------- static bool is_eof(Env *env) { return env->lexer->eof(env->lexer); } static bool not_eof(Env *env) { return !(is_eof(env)); } /** * The parser's position in the current line. * Note: This is expensive to use. */ static uint32_t column(Env *env) { return is_eof(env) ? 0 : env->lexer->get_column(env->lexer); } /** * tree-sitter's lexer interface maintains a current position that determines the lookahead character and the range of * text that is associated with the symbol selected by the scanner, if `mark_end` is called. * * It's not possible to read earlier characters once the lexer has advanced over them, so this function appends the * lookahead character to the array `lookahead` in the `State`. * * Don't add zeroes to the lookahead buffer when hitting EOF – it causes `no_lookahead` to report false negatives. */ static void advance(Env *env) { if (not_eof(env)) { array_push(&env->state->lookahead, PEEK); env->lexer->advance(env->lexer, false); } } static bool set_result_symbol(Env *env, Symbol result) { if (result != FAIL) { env->lexer->result_symbol = (TSSymbol) result; return true; } return false; } #ifdef TREE_SITTER_DEBUG static void mark_debug(Env *env, const char *restrict marked_by) { dbg("mark: %s\n", marked_by); env->debug.marked = (int) column(env); env->debug.marked_line = 0; env->debug.marked_by = marked_by; env->lexer->mark_end(env->lexer); } static void append_parse_buffer(Env *env); static void advance_debug(Env *env) { append_parse_buffer(env); advance(env); } static void skip_debug(Env *env) { append_parse_buffer(env); env->lexer->advance(env->lexer, true); } #endif /** * `inline` has a noticeable impact, reaching parity with a macro. */ static inline bool valid(Env *env, Symbol s) { return env->symbols[s]; } // -------------------------------------------------------------------------------------------------------- // Symbol constructors // -------------------------------------------------------------------------------------------------------- static Symbol finish(Symbol s, const char *restrict desc) { // Suppress unused param warning (void) desc; dbg("finish: %s\n", desc); return s; } static Symbol finish_if_valid(Env *env, Symbol s, const char *restrict desc) { if (valid(env, s)) return finish(s, desc); return FAIL; } static Symbol finish_marked(Env *env, Symbol s, const char *restrict desc) { (void) desc; MARK(desc); return s; } static Symbol update_state(const char *restrict desc) { return finish(UPDATE, desc); } // -------------------------------------------------------------------------------------------------------- // Lookahead // -------------------------------------------------------------------------------------------------------- /** * Ensure that at least `abs + 1` characters are present in the lookahead buffer by calling `advance` `len - abs + 1` * times. */ static void advance_over_abs(Env *env, uint32_t abs) { for (uint32_t i = env->state->lookahead.size; i <= abs; i++) S_ADVANCE; } /** * Ensure that at least `rel` characters after and including the current `offset` are present in the lookahead buffer by * calling `advance` as often as the difference between the desired index (`offset + rel`) and one less than the current * buffer size. * * Note: The character at the offset is included in the range, so that when `len == offset == rel == 0`, this function * advances once, over the character at index 0. */ static void advance_over(Env *env, uint32_t rel) { advance_over_abs(env, env->state->lookahead.offset + rel); } /** * Skip whitespace relative to `offset`, but keep characters that have already been copied to the buffer. * * Example: * * > a = b * ^ * * Assume step A sets `offset` to 1, pointing to the first space. * Step B calls `peek1`, to look at the `=`. This needs to advance over the space, which is copied to the lookahead * buffer, causing `lexer->lookahead` to return `=`. * Step C then calls `peek0`, sees that it is a space, and requests that it be skipped. Since it is already in the * buffer, calling `lexer-advance` would skip the wrong character. * * Hence, this function only skips indexes larger than the lookahead buffer's `len`. * * Additionally, if `offset` has been set to a position outside of the buffer, all characters up to that index are * copied to the buffer beforehand. */ static void skip_over(Env *env, uint32_t rel) { Lookahead *l = &env->state->lookahead; // Subtraction is safe because the condition establishes that `offset` is at least 1 if (l->offset > l->size) advance_over_abs(env, l->offset - 1); uint32_t abs = l->offset + rel; for (uint32_t i = env->state->lookahead.size; i <= abs; i++) S_SKIP; } /** * Ensure that the lookahead buffer is large enough to allow reading the `n`th character. * Since `lexer->lookahead` points at the character after the buffer, it must have `offset + n - 1` elements. */ static void advance_before(Env *env, uint32_t rel) { uint32_t abs = env->state->lookahead.offset + rel; if (abs > 0) advance_over_abs(env, abs - 1); } /** * Return the lookahead character with index `n`. * If the index is larger than the lookahead buffer, return 0. * * Unsafe insofar as that it does not advance if the index points outside of the lookahead buffer. * This may happen in regular operation when a tool like `seq` attempts to look beyond EOF. */ static int32_t unsafe_peek_abs(Env *env, uint32_t abs) { return abs < env->state->lookahead.size ? env->state->lookahead.contents[abs] : 0; } /** * Return the lookahead character with index `offset + n`. * See `unsafe_peek_abs`. */ static int32_t unsafe_peek(Env *env, uint32_t rel) { return unsafe_peek_abs(env, env->state->lookahead.offset + rel); } #ifdef TREE_SITTER_DEBUG static void debug_peek(Env *env, uint32_t rel) { uint32_t abs = env->state->lookahead.offset + rel; dbg("peek "); if (env->state->lookahead.offset > 0) dbg("%u->", env->state->lookahead.offset); dbg("%u", rel); if (abs < env->state->lookahead.size) dbg(" cached | len: %u", env->state->lookahead.size); else if (abs > env->state->lookahead.size) dbg(" advance | len: %u", env->state->lookahead.size); dbg("\n"); } #endif /** * Return the lookahead character with index `offset + rel`. * If the character is not accessible, advance the position until it is. * * This "peeks" insofar as it doesn't advance over the requested character – `peek(0)` is equivalent to * `lexer->lookahead` if `offset == 0`. */ static int32_t peek(Env *env, uint32_t rel) { #ifdef TREE_SITTER_DEBUG debug_peek(env, rel); #endif if (env->state->lookahead.offset + rel < env->state->lookahead.size) return unsafe_peek(env, rel); else { advance_before(env, rel); return PEEK; } } /** * Return the first lookahead character after the `offset` without advancing the position. */ static int32_t peek0(Env *env) { return peek(env, 0); } /** * Return the second lookahead character after the `offset` without advancing the position further than the first * character. */ static int32_t peek1(Env *env) { return peek(env, 1); } /** * Return the third lookahead character after the `offset` without advancing the position further than the second * character. */ static int32_t peek2(Env *env) { return peek(env, 2); } /** * Test the lookahead character at index `offset + n` for equality. */ static bool char_at(Env *env, uint32_t n, int32_t c) { return peek(env, n) == c; } /** * Test the lookahead character at index `offset` for equality. */ static bool char0(Env *env, int32_t c) { return char_at(env, 0, c); } /** * Test the lookahead character at index `offset + 1` for equality. */ static bool char1(Env *env, int32_t c) { return char_at(env, 1, c); } /** * Test the lookahead character at index `offset + 2` for equality. */ static bool char2(Env *env, int32_t c) { return char_at(env, 2, c); } /** * Set the offset to `index`, so that the indexes in future calls to lookahead functions like `char0` are interpreted * relative to this new value. * * Resets `symop` for soundness, even though no rule would continue after advancing over symbolic characters. * * See 'Lookahead' for an example. */ static void reset_lookahead_abs(Env *env, uint32_t abs) { dbg("reset: %u\n", abs); env->state->lookahead.offset = abs; env->symop = 0; } static void reset_lookahead_to(Env *env, uint32_t rel) { reset_lookahead_abs(env, env->state->lookahead.offset + rel); } /** * Move `offset` to the end of the consumed lookahead, causing `peek`, `char0` etc. to operate on characters following * the current position at the time this function is executed. */ static void reset_lookahead(Env *env) { reset_lookahead_abs(env, env->state->lookahead.size); } /** * Return whether the lookahead position has been advanced since starting the run, not considering skipped characters * (which are usually whitespace). * This is important to decide whether the scanner has to be restarted to emit certain symbols. * * For example, before starting layouts and generating layout semicolons after newlines, we skip whitespace and mark, so * that subsequent symbols start at their non-whitespace boundary instead of before the newline(s). * When newline lookahead mode finishes, it can continue directly with this step _only if_ no non-whitespace characters * were consumed, otherwise they would be included in the semicolon symbol. * We also cannot unconditionally mark after whitespace in newline lookahead mode since there are several potential * symbols that can be emitted before skipped whitespace is marked, like layout end, which should not extend beyond * newlines. */ static bool no_lookahead(Env *env) { return env->state->lookahead.size == 0; } /** * Return the column of the first lookahead character of the current run. * This is needed for starting layouts in interior mode, since we don't count positions across interior runs. */ static uint32_t start_column(Env *env) { return column(env) - env->state->lookahead.size; } /** * Increment `i` while the predicate is true for the lookahead character at that index (relative to `offset`), advancing * the position when `i` points beyond the end of the lookahead buffer. * Return the index after the last matching character. */ static uint32_t advance_while(Env *env, uint32_t i, bool (*pred)(int32_t)) { while (pred(peek(env, i))) { i++; } return i; } /** * Same as `advance_while`, using "not equal to `c`" for the predicate. * Stops at EOF. */ static uint32_t advance_until_char(Env *env, uint32_t i, int32_t c) { while (not_eof(env) && !char_at(env, i, c)) { i++; } return i; } // -------------------------------------------------------------------------------------------------------- // Context manipulation and conditions // -------------------------------------------------------------------------------------------------------- static bool has_contexts(Env *env) { return env->state->contexts.size != 0; } /** * Push a layout context onto the stack. */ static void push_context(Env *env, ContextSort sort, uint32_t indent) { dbg("push: %s %d\n", context_names[sort], indent); Context ctx = (Context) {.sort = sort, .indent = indent}; array_push(&env->state->contexts, ctx); } /** * Remove a layout context from the stack. */ static void pop(Env *env) { if (has_contexts(env)) { dbg("pop: %s\n", context_names[array_back(&env->state->contexts)->sort]); array_pop(&env->state->contexts); } } static ContextSort current_context(Env *env) { return has_contexts(env) ? array_back(&env->state->contexts)->sort : NoContext; } static bool is_layout_context(Env *env) { return current_context(env) < Braces; } /** * Decide whether the current context requires generation of layout semicolons. * This is true for all layout contexts except for multi-way if, since that uses `|` to start layout elements. */ static bool is_semicolon_context(Env *env) { return current_context(env) < MultiWayIfLayout; } /** * Return the indent of the innermost layout context. * If there are non-layout contexts at the top of the stack, search downwards. */ static uint32_t current_indent(Env *env) { for (int32_t i = (int32_t) env->state->contexts.size - 1; i >= 0; i--) { Context *cur = array_get(&env->state->contexts, i); if (cur->sort < Braces) return cur->indent; } return 0; } static bool indent_less(Env *env, uint32_t indent) { return is_layout_context(env) && indent < current_indent(env); } static bool indent_lesseq(Env *env, uint32_t indent) { return is_layout_context(env) && indent <= current_indent(env); } static bool top_layout(Env *env) { return env->state->contexts.size == 1; } static bool in_module_header(Env *env) { return current_context(env) == ModuleHeader; } /** * Return the appropriate symbol to close the given context, or FAIL if it can't be closed. */ static Symbol context_end_sym(ContextSort s) { switch (s) { case TExp: return END_TEXP; case Braces: return END_BRACE; default: return s < Braces ? END : FAIL; } } // -------------------------------------------------------------------------------------------------------- // Character and lookahead conditions // -------------------------------------------------------------------------------------------------------- #define NEWLINE_CASES \ case '\n': \ case '\r': \ case '\f' static bool is_newline(int32_t c) { switch (c) { NEWLINE_CASES: return true; default: return false; } } static bool varid_start_char(const int32_t c) { return c == '_' || is_varid_start_char(c); } // TODO This should be combined with is_inner_id_char and made more explicit about when which char can occur. // For example, lex_symop uses this to decide about prefix dot being a field selector, where single quotes aren't valid. static bool is_id_char(const int32_t c) { return c == '_' || c == '\'' || is_identifier_char(c); } // TODO hashes only work at the end of identifiers static bool is_inner_id_char(const int32_t c) { return is_id_char(c) || c == '#'; } static bool quoter_char(const int32_t c) { return is_id_char(c) || c == '.'; } static bool reserved_symbolic(const int32_t c) { switch (c) { case '(': case ')': case ',': case ';': case '[': case ']': case '`': case '{': case '}': case '"': case '\'': case '_': return true; default: return false; } } static bool symop_char(const int32_t c) { return is_symop_char(c) && !reserved_symbolic(c); } /** * Advance the position to the first character that's not valid for a symbolic operator, and return that position. * If the function has been called before, directly return the cached position. * * This consumes the entire symop, since the field denotes the length of the string and therefore the last (failing) * peek is _beyond_ the end, consuming the last valid char. */ static uint32_t symop_lookahead(Env *env) { if (env->symop == 0) { env->symop = advance_while(env, 0, symop_char); if (env->symop > 0) dbg("symop: %d, %.*ls\n", env->symop, env->symop, env->state->lookahead.contents + env->state->lookahead.offset); } return env->symop; } static bool is_symop(Env *env) { return symop_lookahead(env) > 0; } /** * The parser calls `scan` with all symbols declared as valid directly after it encountered an error. * The symbol `FAIL` is not used in the grammar, so it can only be valid in this error case. */ static bool after_error(Env *env) { return valid(env, FAIL); } // -------------------------------------------------------------------------------------------------------- // Debug printing // -------------------------------------------------------------------------------------------------------- #ifdef TREE_SITTER_DEBUG static void push_parse_buffer_line(Env *env) { ParseLine new_line = array_new(); array_reserve(&new_line, 1); array_push(&env->state->parse, new_line); } static ParseLine *ensure_parse_buffer(Env *env) { ParseLines *buffer = &env->state->parse; if (buffer->size == 0) push_parse_buffer_line(env); if (is_newline(PEEK)) push_parse_buffer_line(env); return array_back(buffer); } static void append_parse_buffer(Env *env) { ParseLine *current_line = ensure_parse_buffer(env); if (is_newline(PEEK)) { env->debug.marked_line++; env->debug.start_line++; } else if (column(env) >= current_line->size) array_push(current_line, PEEK); } static void fill_parse_buffer(Env *env) { env->debug.end_col = column(env); while (!(is_newline(PEEK) || is_eof(env))) S_ADVANCE; } static bool seq(Env *env, const char *restrict s); static void print_lookahead(Env *env) { dbg("lookahead: %.*ls\n", env->state->lookahead.size, env->state->lookahead.contents); } static const char * space = ""; static const char * newline_char = "\\n"; static const char * show_char(int32_t c) { switch (c) { NEWLINE_CASES: return newline_char; case ' ': case '\t': case '\v': return space; default: return NULL; } } static void print_lookahead_chars_from(Env *env, uint32_t start) { if (start < env->state->lookahead.size) { dbg("lookahead from %d: ", start); for (; start < env->state->lookahead.size; start++) { int32_t c = env->state->lookahead.contents[start]; const char * s = show_char(c); if (s == NULL) dbg("%lc", c); else dbg("%s", s); } dbg("\n"); } else dbg("print_lookahead_chars_from: Too large (%d / %d)", start, env->state->lookahead.size); } static void debug_contexts(Env *env) { if (env->state->contexts.size == 0) dbg("empty"); bool empty = true; for (size_t i = 0; i < env->state->contexts.size; i++) { if (!empty) dbg("-"); Context ctx = *array_get(&env->state->contexts, i); if (ctx.sort == ModuleHeader) dbg("pre"); else if (ctx.sort == Braces) dbg("brace"); else if (ctx.sort == TExp) dbg("texp"); else { if (ctx.sort == DoLayout) dbg("do "); else if (ctx.sort == LetLayout) dbg("let "); else if (ctx.sort == CaseLayout) dbg("case "); else if (ctx.sort == MultiWayIfLayout) dbg("if "); else if (ctx.sort == QuoteLayout) dbg("quote "); dbg("%d", ctx.indent); } empty = false; } } void debug_newline(Env *env) { switch (env->state->newline.state) { case NInactive: dbg("no"); break; case NInit: dbg("init"); break; case NProcess: dbg("process"); break; case NResume: dbg("resume"); break; } if (env->state->newline.state != NInactive) dbg(" %d %s", env->state->newline.indent, token_names[env->state->newline.end]); if (env->state->newline.eof) dbg(" [eof]"); if (env->state->newline.no_semi) dbg(" [no_semi]"); if (env->state->newline.skip_semi) dbg(" [skip_semi]"); if (env->state->newline.unsafe) dbg(" [unsafe]"); } /** * Produce a comma-separated string of valid symbols. */ static void debug_valid(Env *env, const bool *syms) { if (after_error(env)) { dbg("all"); return; } bool fst = true; for (Symbol i = FAIL; i <= UPDATE; i++) { if (syms[i]) { if (!fst) dbg(","); dbg("%s", sym_names[i]); fst = false; } } } static bool debug_init(Env *env) { setlocale(LC_ALL, "C.UTF-8"); dbg("\n"); dbg("state:\n syms = "); debug_valid(env, env->symbols); dbg("\n contexts = "); debug_contexts(env); dbg("\n newline = "); debug_newline(env); dbg("\n"); return false; } void sgr(const char *restrict code) { dbg("\x1b[%sm", code); } void color(unsigned c) { char code[3]; sprintf(code, "3%d", c); sgr(code); } void palette() { color(4); dbg("before"); color(2); dbg(" marked"); color(3); dbg(" advanced"); color(5); dbg(" lookahead"); sgr(""); dbg("\n"); } static bool debug_parse_metadata = false; static void dump_parse_metadata(Env *env) { Debug *debug = &env->debug; dbg( "lines: %d | start_line: %d | start_col: %d | marked_line: %d | marked: %d | end_col: %d | persist lines: %d\n", env->state->parse.size, debug->start_line, debug->start_col, debug->marked_line, debug->marked, debug->end_col, env->state->parse.size - debug->marked_line ); } /** * Note: We're printing individual characters here instead of using a format with precision like `%.*ls` and slicing * the buffer, because: * - The buffer contains wide characters, but `fprintf` counts bytes * - `fwprintf` counts wide characters, but can't be interleaved with `fprintf`, so we'd have to use that function, and * therefore wide literals, everywhere, which is tedious */ void debug_parse(Env *env) { Debug *debug = &env->debug; ParseLines *buffer = &env->state->parse; uint32_t lines = buffer->size; dbg("-----------------------\n"); // For investigating mistakes in the debugging code. if (debug_parse_metadata) dump_parse_metadata(env); if (lines > 0) { color(4); for (uint32_t i = 0; i < lines; i++) { ParseLine *line = array_get(buffer, i); int32_t *buf = line->contents; if (line->contents == NULL) break; uint32_t pos = 0; if (debug->start_line == lines - 1 - i) { while (pos < debug->start_col) { dbg("%lc", buf[pos]); pos++; } color(2); } if (debug->marked >= 0 && debug->marked_line == lines - 1 - i) { while ((int) pos < debug->marked) { dbg("%lc", buf[pos]); pos++; } color(3); } if (i == lines - 1) { while (pos < debug->end_col) { dbg("%lc", buf[pos]); pos++; } color(5); } while (pos < line->size) { dbg("%lc", buf[pos]); pos++; } dbg("\n"); } sgr(""); } dbg("-----------------------\n"); } static unsigned serialize_parse_lines(char *cursor, ParseLines *parse, unsigned to_copy) { for (unsigned i = 0; i < parse->size; i++) { ParseLine *line = array_get(parse, i); unsigned line_size = line->size * sizeof(uint32_t); to_copy += line_size + sizeof(uint32_t); if (to_copy > TREE_SITTER_SERIALIZATION_BUFFER_SIZE) return 0; *((uint32_t *) cursor) = line->size; cursor += sizeof(line->size); memcpy(cursor, line->contents, line_size); cursor += line_size; } return to_copy; } static void deserialize_parse_lines(const char *cursor, ParseLines *parse, uint32_t size) { // Ensure ParseLines has room for at _least_ as many lines as the new state array_reserve(parse, size); for (unsigned i = 0; i < size; i++) { if (i >= parse->size) { array_push(parse, (ParseLine)array_new()); } ParseLine *line = &parse->contents[i]; uint32_t line_len = *((uint32_t *) cursor); cursor += sizeof(uint32_t); array_reserve(line, line_len); line->size = line_len; unsigned line_size = line->size * sizeof(uint32_t); memcpy(line->contents, cursor, line_size); cursor += line_size; } // Free the excessive lines in the previous since we can't check in the next round whether there was a line in // a slot before and reuse the pointer. // This only happens when we didn't push any lines above, which would reset parse->len to len. for (unsigned i = parse->size; i > size; i--) { array_delete(array_get(parse, i - 1)); } // Truncate ParseLines in case the new state has fewer lines parse->size = size; } void debug_finish(Env *env, Symbol result) { dbg("result: "); if (result) dbg("%s, ", sym_names[result]); else dbg(", "); if (env->debug.marked == -1) dbg("%d", column(env)); else dbg("%s@%d", env->debug.marked_by, env->debug.marked); dbg("\n\n"); fill_parse_buffer(env); debug_parse(env); env->state->parse.size -= env->debug.marked_line; } #endif // -------------------------------------------------------------------------------------------------------- // Lookahead // -------------------------------------------------------------------------------------------------------- /** * Check if lookahead contains the string `s` starting at position `offset + start`. * This advances only over matching characters. */ static bool seq_from(Env *env, const char *restrict s, uint32_t start) { uint32_t len = (uint32_t) strlen(s); for (uint32_t i = 0; i < len; i++) { int32_t c = s[i]; int32_t c2 = peek(env, start + i); if (c != c2) return false; } peek(env, start + len); return true; } /** * Check if lookahead contains the string `s` starting at position `offset`. */ static bool seq(Env *env, const char *restrict s) { return seq_from(env, s, 0); } /** * Advance until the next newline or EOF, used to consume the body of a comment. */ static void take_line(Env *env) { while (not_eof(env) && !is_newline(PEEK)) S_ADVANCE; } static bool is_space_or_tab(int32_t c) { return c == ' ' || c == '\t'; } /** * Advance until the next newline or EOF, used to consume the body of a cpp directive. * Escaped newlines are treated as line continuations, which allow spaces and tabs between backslash and newline. */ static void take_line_escaped_newline(Env *env) { for (;;) { while (not_eof(env) && !is_newline(PEEK) && PEEK != '\\') S_ADVANCE; if (PEEK == '\\') { S_ADVANCE; if (is_space_or_tab(PEEK)) { while (is_space_or_tab(PEEK)) S_ADVANCE; if (is_newline(PEEK)) S_ADVANCE; } else S_ADVANCE; } else return; } } /** * Skip the lexer until the following character is neither space nor tab. * Return whether any characters were skipped. */ static bool skip_space(Env *env) { if (!is_space_char(PEEK)) return false; S_SKIP; while(is_space_char(PEEK)) S_SKIP; return true; } /** * Skip the lexer until the following character is not a newline. * Return whether any characters were skipped. */ static bool skip_newlines(Env *env) { if (!is_newline(PEEK)) return false; S_SKIP; while(is_newline(PEEK)) S_SKIP; return true; } typedef enum { NoSpace, Indented, BOL, } Space; /** * Alternate between skipping space and newlines, and return which was seen last. * This does not use the lookahead buffer, but directly accesses the lexer. * Only to be used when it is certain that no whitespace has been copied to the buffer by previous steps, and that no * previous characters should be included in the range of non-zero-width symbol. */ static Space skip_whitespace(Env *env) { Space space = NoSpace; while (true) { if (skip_space(env)) space = Indented; else if (skip_newlines(env)) space = BOL; else return space; }; } /** * Advance the lexer until the following character is neither space nor tab, starting at position `offset + start`, and * return the index of the next character. */ static uint32_t take_space_from(Env *env, uint32_t start) { return advance_while(env, start, is_space_char); } /** * Ensure that the character after a keyword like `module` is not a character that would change its meaning to be an * identifier. */ static bool token_end(int32_t c) { return !is_inner_id_char(c); } /** * Check if lookahead contains the string `s` starting at position `offset + start`, followed by a non-id character. * See `seq`. */ static bool token_from(Env *env, const char *restrict s, uint32_t start) { return seq_from(env, s, start) && token_end(peek(env, start + (uint32_t) strlen(s))); } /** * `token_from` at the current offset. */ static bool token(Env *env, const char *restrict s) { return seq(env, s) && token_end(peek(env, (uint32_t) strlen(s))); } /** * Check if lookahead contains any of the strings in `tokens` starting at position `offset + start`, followed by a * non-id character. */ static bool any_token_from(Env *env, size_t n, const char * tokens[], uint32_t start) { for (size_t i = 0; i < n; i++) { if (token_from(env, tokens[i], start)) return true; } return false; } static bool match_symop(Env *env, const char *restrict target) { return symop_lookahead(env) == strlen(target) && seq(env, target); } static bool uninitialized(Env *env) { return !has_contexts(env); } static uint32_t conid(Env *env) { if (!is_conid_start_char(peek0(env))) return 0; return advance_while(env, 1, is_inner_id_char); } typedef enum { NoQualifiedName, QualifiedTarget, QualifiedConid, } QualifiedName; static QualifiedName qualified_name(Env *env, bool (*name)(Env *)) { bool qualified = false; while (true) { uint32_t end = conid(env); if (end == 0) break; if (!char_at(env, end, '.')) { if (qualified) return QualifiedConid; else break; } qualified = true; reset_lookahead_to(env, end + 1); if (name(env)) return true; } return NoQualifiedName; } /** * Use the lookahead buffer to determine whether a character is escaped, by counting the number of backslashes. */ static bool odd_backslashes_before(Env *env, int32_t index) { bool odd = false; while (index >= 0 && peek(env, (uint32_t) index) == '\\') { odd = !odd; index--; } return odd; } /** * Advance before the next unescaped double quote. */ static uint32_t take_string_literal(Env *env) { uint32_t end = 1; while (true) { end = advance_until_char(env, end, '"') + 1; if (is_eof(env) || !odd_backslashes_before(env, (int) end - 2)) return end; } } /** * Advance before the single quote that validly ends a character literal. * If there is none, return 1. * Either the first character is a backslash, or the second character is a single quote. * * A single quote followed by backslash is a char unless it was part of a varid, in which case the backslash is a * lambda. * The caller must make sure to lex varids beforehand. */ static uint32_t take_char_literal(Env *env) { if (char1(env, '\\')) return advance_until_char(env, 2, '\'') + 2; else return char_at(env, 2, '\'') ? 3 : 1; } // -------------------------------------------------------------------------------------------------------- // Lookahead: CPP // -------------------------------------------------------------------------------------------------------- typedef enum { CppNothing, CppStart, CppElse, CppEnd, CppOther, } CppDirective; static const char *cpp_tokens_start[3] = { "if", "ifdef", "ifndef", }; static bool cpp_cond_start(Env *env, uint32_t start) { return any_token_from(env, 3, cpp_tokens_start, start); } static const char *cpp_tokens_else[4] = { "else", "elif", "elifdef", "elifndef", }; static bool cpp_cond_else(Env *env, uint32_t start) { return any_token_from(env, 4, cpp_tokens_else, start); } static bool cpp_cond_end(Env *env, uint32_t start) { return token_from(env, "endif", start); } static const char *cpp_tokens_other[7] = { "define", "undef", "include", "pragma", "error", "warning", "line", }; static bool cpp_directive_other(Env *env, uint32_t start) { return any_token_from(env, 7, cpp_tokens_other, start) || // A hash followed by nothing but whitespace is CPP. // If non-whitespace follows whitespace, it is a parse error, unless we're in a brace layout; then it is a varsym. // Complete overkill to parse this, but eh! is_newline(peek(env, start)) || // shebang for scripts (char1(env, '!') && uninitialized(env)) ; } /** * If the first character at `offset` is a hash, skip space and try all tokens that start a CPP directive. * Return the matching variant of the enum `CppDirective`. */ static CppDirective cpp_directive(Env *env) { if (!char0(env, '#')) return CppNothing; uint32_t start = take_space_from(env, 1); if (cpp_cond_start(env, start)) return CppStart; else if (cpp_cond_else(env, start)) return CppElse; else if (cpp_cond_end(env, start)) return CppEnd; else if (cpp_directive_other(env, start)) return CppOther; else return CppNothing; } // -------------------------------------------------------------------------------------------------------- // Starting layouts // -------------------------------------------------------------------------------------------------------- /** * Opening and closing braces are always followed by a command (`grammar/util.js`), so this can unconditionally push a * context. * See `grammar/externals.js` for more. * * Note: This is not related to regular brace layouts, which are handled by `start_layout`! * Aside from layouts, braces are also used for records and inferred type variables, where indentation is also ignored! * Therefore, we add a context to skip steps like semicolon generation. * * Check out some examples in the tests: * - data: record zero indent * - type decl: inferred quantifier at column 0 */ static Symbol start_brace(Env *env) { if (valid(env, START_BRACE)) { push_context(env, Braces, 0); return finish(START_BRACE, "start_brace"); } return FAIL; } /** * See `start_brace`. */ static Symbol end_brace(Env *env) { if (valid(env, END_BRACE) && current_context(env) == Braces) { pop(env); return finish(END_BRACE, "end_brace"); } return FAIL; } /** * Return the first valid layout start symbol. */ static Symbol valid_layout_start_sym(Env *env) { for (Symbol i = START; i < END; i++) { if (valid(env, i)) return i; } return FAIL; } /** * Map `Symbol` to `ContextSort`. */ static ContextSort layout_sort(Symbol s) { switch (s) { case START_DO: return DoLayout; case START_CASE: return CaseLayout; case START_IF: return MultiWayIfLayout; case START_LET: return LetLayout; case START_QUOTE: return QuoteLayout; default: return DeclLayout; } } typedef struct { Symbol sym; ContextSort sort; } StartLayout; /** * Determine whether the layout sort corresponding to the potentially valid symbol can start at this position. * If the context stack is `uninitialized`, the first layout is added by `process_token_init`. * In newline processing mode, brace layouts cannot be started because there may be comments before the brace that need * to be emitted first. * Regular `if/then/else` conditionals are always valid at the same position as multi-way if layouts. * If we were to unconditionally start a layout when START_IF is valid, it would never be possible to parse the former, * so this skips that layout sort unless the `Lexed` token is `LBar`. */ static StartLayout valid_layout_start(Env *env, Lexed next) { StartLayout start = {.sym = valid_layout_start_sym(env), .sort = NoContext}; if (uninitialized(env) || start.sym == FAIL) return start; ContextSort sort = layout_sort(start.sym); switch (next) { case LBar: break; case LBraceOpen: if (newline_active(env)) return start; sort = Braces; start.sym = START_EXPLICIT; break; default: if (sort == MultiWayIfLayout) return start; break; } start.sort = sort; return start; } /** * If the current context is a brace layout, any indent is legal for a new layout. * Otherwise, compare with the indent of the current context. * Since starting layouts is allowed in tuple expressions, we look at the last real indent, skipping over `TExp`s, using * 0 if none exists (which should never be the case). * * According to the docs for `NondecreasingIndentation`, the rule is that a nested context may start at the same column * _if the enclosing context is a do expression_. * From experimental evidence, it appears though that this is the other way round – a do expression within, say, a case * alt can start at the same level as the case layout. */ static bool indent_can_start_layout(Env *env, ContextSort sort, uint32_t indent) { if (current_context(env) == Braces) return true; uint32_t cur = current_indent(env); return (indent > cur || (indent == cur && sort == DoLayout)); } /** * Start the given layout if the position allows it: * * - If the current context is `ModuleHeader`, the layout must be the `where` after `module`, so any indent is valid. * - If the new layout is a brace layout, legal indent is technically required, but we can be lenient since there's no * other way to interpret an opening brace after a layout opener. * However, we need to mark to include the brace in the range to create a terminal (see `grammar/externals.js` for * why). * * - Otherwise, examine indent. */ static Symbol start_layout(Env *env, const StartLayout start, uint32_t indent, const char * restrict desc) { if (in_module_header(env)) pop(env); else if (start.sort == Braces) MARK("start_layout brace"); else if (!indent_can_start_layout(env, start.sort, indent)) return FAIL; push_context(env, start.sort, indent); return finish(start.sym, desc); } /** * The indent of a layout started at an interior token can only be determined by calling `get_column`. * This is an expensive operation, but hopefully it is rare enough to not make a substantial dent. * Because we might have advanced beyond the layout's start position to check conditions, we need to subtract the length * of the lookahead buffer from the current column. * Whitespace is skipped, and not added to the buffer, so the resulting position is after whitespace. */ static Symbol start_layout_interior(Env *env, Lexed next) { StartLayout start = valid_layout_start(env, next); if (start.sort == NoContext) return FAIL; return start_layout(env, start, start_column(env), "interior"); } /** * The indent of a layout started at the beginning of a line is determined by `newline_lookahead`, so this does not have * to compute it. */ static Symbol start_layout_newline(Env *env) { StartLayout start = valid_layout_start(env, env->state->newline.end); if (start.sort == NoContext) return FAIL; Symbol result = start_layout(env, start, env->state->newline.indent, "newline"); if (result != FAIL) env->state->newline.no_semi = true; return result; } /** * See `token_end_layout_texp`. */ static Symbol texp_context(Env *env) { if (valid(env, START_TEXP)) { push_context(env, TExp, 0); return finish(START_TEXP, "texp_context"); } else if (valid(env, END_TEXP) && current_context(env) == TExp) { pop(env); return finish(END_TEXP, "texp_context"); } else return FAIL; } // -------------------------------------------------------------------------------------------------------- // Ending layouts // -------------------------------------------------------------------------------------------------------- /** * Separated this from `end_layout` because it caused some weird performance glitches. */ static Symbol end_layout_unchecked(Env *env, const char *restrict desc) { pop(env); return finish(END, desc); } /** * If a layout end is valid at this position, pop a context and succeed with layout end. */ static Symbol end_layout(Env *env, const char *restrict desc) { if (valid(env, END)) return end_layout_unchecked(env, desc); else return FAIL; } /** * Explicit brace layouts need a dedicated symbol, see `_cmd_layout_start_explicit` for an explanation. * Includes the brace in the range. */ static Symbol end_layout_brace(Env *env) { if (valid(env, END_EXPLICIT) && current_context(env) == Braces) { advance_over(env, 0); MARK("end_layout_brace"); pop(env); return finish(END_EXPLICIT, "brace"); } else return FAIL; } /** * End a layout based on indent decrease. * * If the indent of the current line is smaller than the indent of the current layout, we end the layout in most cases. * Exceptions are: * * - Brace layouts * - The top-level layout, which should only be ended at the end of file. * For leniency, we change the current indent to the smaller value. */ static Symbol end_layout_indent(Env *env) { if (valid(env, END) && indent_less(env, env->state->newline.indent)) { if (top_layout(env)) { array_back(&env->state->contexts)->indent = env->state->newline.indent; return update_state("end top layout"); } else { env->state->newline.skip_semi = false; return end_layout_unchecked(env, "indent"); } } return FAIL; } /** * An expression layout may be closed by an infix operator when it is not valid at that position: * * a :: IO Int * a = do a <- pure 5 * pure a * >>= pure * * In this situation, the indent of the operator causes a semicolon to be generated, which leads to varsym being invalid * lookahead. * The layout is closed and the entire `do` block becomes the left operand of the `>>=`. * The same applies for `infix` id operators. * * It doesn't apply to multi-way if layouts, because those don't use semicolons. */ static Symbol end_layout_infix(Env *env) { if (!valid(env, VARSYM) && !valid(env, CONSYM)) return end_layout(env, "symop invalid"); return FAIL; } /** * A case alt can have a `where` clause attached to it, so a case layout is ended by a `where` only if its indent is * equal to or smaller than the layout indent. * * A `do` or `if` cannot have a `where`, so they are always terminated. * * It would be tempting to leave it at that, but there can be multiple successive `where` clauses. * If a `case` is followed by two of them (greater indent), the first one would attach to the last alt. * The second one would have to close the `case` layout and attach to the next higher allowed place (e.g. the enclosing * function decl), but if its indent is greater, this cannot be detected here – it would just seem like a `where` * attaching to an alt, since we don't keep track of the number of `where`s encountered (and we couldn't, since we're * dealing with layouts, not case alts). * * By tracking the validity of `where` symbols, we can simplify the condition for `do` and `if`: End any layout when * `where` is parsed, but invalid. */ static Symbol end_layout_where(Env *env) { if (valid(env, END) && !valid(env, WHERE) && is_layout_context(env)) return end_layout(env, "where"); return FAIL; } /** * Ending layouts with `in` heavily relies on parse errors in GHC, so this is difficult. * The heuristic here is that if `in` is not valid (i.e. a parse error), we pop any layout. * * Take the example of some inline layouts in a let decl: * `let a = case a of a -> do a in a` * The `do` and `case` layouts have valid `END` symbols at the `in`, but `in` itself is not valid as long as the `case` * hasn't reduced, so we pop until we find `IN`. * * This isn't enough though, since `let` also opened a layout that ends here, so we have to test for that explicitly. * * Note that this doesn't allow the `in` of a nested `let` to close the outer `let`, since the `END` for that isn't * valid before the inner `let` has reduced. */ static Symbol end_layout_in(Env *env) { if (valid(env, END) && (!valid(env, IN) || current_context(env) == LetLayout)) return end_layout(env, "in"); return FAIL; } /** * For GADT constructor layouts. */ static Symbol end_layout_deriving(Env *env) { if (valid(env, END) && !valid(env, DERIVING) && !top_layout(env) && current_context(env) == DeclLayout) return end_layout(env, "deriving"); return FAIL; } /** * Return `true` if there is a `TExp` context on the stack and only layouts above it. */ static bool layouts_in_texp(Env *env) { if (is_layout_context(env) && (env->state->contexts.size > 1)) { for (int32_t i = (int32_t) env->state->contexts.size - 2; i >= 0; i--) { Context *cur = array_get(&env->state->contexts, i); if (cur->sort == TExp || cur->sort == Braces) return true; else if (cur->sort > Braces) break; } } return false; } /** * Tuple expressions are constructs that syntactically delimit their contents in an unambiguous way that makes parsing * a lot easier. * In GHC, this concept is used to classify productions like view patterns and annotated expressions. * For us, unfortunately, it also means that there are significantly more circumstances in which layouts can be ended by * parse errors. * * In practice, it means that expression layouts can be closed by commas, vertical bars and closing brackets and parens * when they are elements in a list or tuple-like construct: * * (case a of a -> a, do a; a, if | a -> a | a -> a) * [case a of a -> a | a <- a] * * We encode this as a special context sort, `TExp`, that is pushed and popped at opening and closing brackets. * * Some other constructs, like guards, have similar characteristics, so we use the same mechanism for them: * * > a = case a of * > a | let a = a -> a * * Here the let layout must be ended by parse error, so we start a tuple expression at the bar and end it at the arrow. */ static Symbol token_end_layout_texp(Env *env) { return (valid(env, END) && layouts_in_texp(env)) ? end_layout(env, "texp") : FAIL; } static Symbol force_end_context(Env *env) { for (int32_t i = (int32_t) env->state->contexts.size - 1; i >= 0; i--) { ContextSort ctx = array_get(&env->state->contexts, i)->sort; Symbol s = context_end_sym(ctx); pop(env); if (s != FAIL && valid(env, s)) return finish(s, "force_end_context"); } return FAIL; } // -------------------------------------------------------------------------------------------------------- // Operators // -------------------------------------------------------------------------------------------------------- /** * Opening tokens are a class of characters that may immediately follow prefix operators like bang pattern `!` or type * application `@`. */ static bool opening_token(Env *env, uint32_t i) { int32_t c = peek(env, i); switch (c) { case 0x27e6: // ⟦ case 0x2987: // ⦇ case '(': case '[': case '"': return true; case '{': return peek(env, i + 1) != '-'; default: // Includes single quote return is_id_char(c); } } /** * Test for reserved operators of two characters. */ static bool valid_symop_two_chars(int32_t first_char, int32_t second_char) { switch (first_char) { case '=': return second_char != '>'; case '<': return second_char != '-'; case ':': return second_char != ':'; default: return true; } } /** * If a prefix operator is not followed by an opening token, it may still be a valid varsym. */ static Lexed lex_prefix(Env *env, Lexed t) { return opening_token(env, 1) ? t : LSymop; } /** * If a splice operator is not followed by an opening token, it may still be a valid varsym. * We only allow variables and parenthesized expressions for performance reasons, though. */ static Lexed lex_splice(int32_t c) { return varid_start_char(c) || c == '(' ? LDollar : LSymop; } /** * Lex special occurrences of symbolic operator characters, or declare a valid operator. * * For the dot: * * - Two dots: `..`: Only used for arithmetic sequences (`[a..10]`). * These conflict with record field projection (`[a.b, c]`) and infix operators (`[a..+b]`), and it's too hard to * disambiguate them without this special rule. * * - Tight dot `a.b.c`: A regular tight op, but it has to get a separate symbol from qualified module dots since those * can be followed by symops. * * - Prefix dot `(.a)`: A regular prefix op, for record dot field selectors. * * - Qualified dot `A.B.c`, `A.B.C`, `A.B.+`: Used primarily for qualified modules, but needs to be accepted for field * selectors as well due to ambiguity. * This is not a regular tight op since it needs to allow symops and conid. */ static Lexed lex_symop(Env *env) { uint32_t len = symop_lookahead(env); if (len == 0) return LNothing; int32_t c1 = unsafe_peek(env, 0); if (len == 1) { switch (c1) { case '?': // A `?` can be the head of an implicit parameter, if followed by a varid. return varid_start_char(peek1(env)) ? LNothing : LSymop; case '#': return char1(env, ')') ? LUnboxedClose : LHash; case '|': return char1(env, ']') ? LQuoteClose : LBar; case '!': return lex_prefix(env, LBang); case '~': return lex_prefix(env, LTilde); case '@': return lex_prefix(env, LAt); case '%': return lex_prefix(env, LPercent); case '$': return lex_splice(peek1(env)); case '.': if (is_id_char(peek1(env))) return LDotId; else if (opening_token(env, 1)) return LDotOpen; else return LSymop; case 0x2192: // → case 0x22b8: // ⊸ return LArrow; case 0x21d2: // ⇒ return LCArrow; case '=': case 0x27e7: // ⟧ case 0x2988: // ⦈ return LTexpCloser; case '*': case '-': return LSymopSpecial; case '\\': case 0x2190: // ← case 0x2200: // ∀ case 0x2237: // ∷ case 0x2605: // ★ case 0x27e6: // ⟦ case 0x2919: // ⤙ case 0x291a: // ⤚ case 0x291b: // ⤛ case 0x291c: // ⤜ case 0x2987: // ⦇ return LNothing; } } else if (len == 2) { if (seq(env, "->")) return LArrow; if (seq(env, "=>")) return LCArrow; int32_t c2 = unsafe_peek(env, 1); switch (c1) { case '$': if (c2 == '$') return lex_splice(peek2(env)); break; case '|': if (c2 == '|' && char2(env, ']')) return LQuoteClose; break; case '.': if (c2 == '.') return LDotDot; else return LDotSymop; break; case '#': // Unboxed unit `(##)` and unboxed sum with missing space `(#| Int #)` if (c2 == '#' || c2 == '|') return LSymopSpecial; break; default: if (!valid_symop_two_chars(c1, c2)) return LNothing; break; } } else switch (c1) { case '-': if (seq(env, "->.")) return LArrow; break; case '.': return LDotSymop; } return LSymop; } /** * If the next character after whitespace starting from `start` is a closing parenthesis, finish with `LEFT_SECTION_OP`. * This is called after a previous step has already lexed a valid infix operator (symbolic or ticked varid). * * Left section operators must be detected here to disambiguate from infix expressions: * * > f = (1 - 2 +) * * When lookahead is `+`, the parser must decide whether to reduce `1 - 2` to `infix` because it is the operand of a * section, or to shift into another `infix`. * With a single lookahead token, this is not decidable. * * Note: The obvious solution would be to make `infix` left-associative, so it would always reduce. * Unfortunately, this doesn't work for minus, due to apparently unsurmountable problems caused by the * apply/infix/negation conflict. * * Note: This will fail if there are extras between the operator and the parenthesis (and the ticks and the varid). * * Note: If the operator isn't followed by a parenthesis, it will be parsed as an infix operator in the next step, since * those are always valid when left sections are (except for qualified symops). * However, this function advances over whitespace to find the paren, so if the next step marks and finishes, it will * either: * - Include the whitespace in its range, if this consumes it * - Have a zero-width range, if this skips whitespace * To mitigate this, we introduce the auxiliary symbol `NO_SECTION_OP`, which is (optionally) valid before infix * operators, but not before section operators. * When this function finds any whitespace before the parenthesis, it will finish with that symbol, so that * `LEFT_SECTION_OP` won't be valid in the next run, but all other infix operators are. */ static Symbol left_section_op(Env *env, uint32_t start) { if (valid(env, LEFT_SECTION_OP)) { advance_before(env, start); Space space = skip_whitespace(env); if (char_at(env, start, ')')) return finish(LEFT_SECTION_OP, "left section"); if (space != NoSpace) return finish_if_valid(env, NO_SECTION_OP, "left section"); } return FAIL; } /** * Specialization of `left_section_op` for ticked infix identifiers. */ static Symbol left_section_ticked(Env *env) { if (valid(env, LEFT_SECTION_OP)) { uint32_t end_tick = advance_until_char(env, 1, '`'); // Could be EOF if (char_at(env, end_tick, '`')) { return left_section_op(env, end_tick + 1); } } return FAIL; } /** * This calls `symop_lookahead` to ensure that the position has advanced beyond the end of the symop, which is necessary * because newline lookahead may have validated the symop in a previous run. * This marks the range to emit a terminal. */ static Symbol finish_symop(Env *env, Symbol s) { if (valid(env, s) || valid(env, LEFT_SECTION_OP)) { uint32_t after_symop = symop_lookahead(env); SEQ(left_section_op(env, after_symop)); MARK("symop"); return s; } return FAIL; } /** * Tight ops like `dot.syntax` require that no initial whitespace was skipped. */ static Symbol tight_op(Env *env, bool whitespace, Symbol s) { if (!whitespace) return finish_if_valid(env, s, "tight_op"); else return FAIL; } /** * Used for situations where the operator is followed by an opening token, and so can be a prefix op if it is preceded * by whitespace; but is no valid tight op and therefore becomes a regular operator if not preceded by whitespace or the * symbol is not valid. * * Only used for `%` (modifier). */ static Symbol prefix_or_varsym(Env *env, bool whitespace, Symbol s) { if (whitespace) SEQ(finish_if_valid(env, s, "prefix_or_varsym")); return finish_symop(env, VARSYM); } /** * Used for situations where the operator is followed by an opening token, and so can be a tight op if it is not * preceded by whitespace; but is no valid prefix op and therefore becomes a regular operator if preceded by whitespace * or the symbol is not valid. * * Only used for `.`, when a projection selector `(.fieldname)` is not valid at this position, so the dot becomes the * composition operator. */ static Symbol tight_or_varsym(Env *env, bool whitespace, Symbol s) { SEQ(tight_op(env, whitespace, s)); return finish_symop(env, VARSYM); } /** * Used for situations where the operator is followed by an opening token, and so can be a tight op if it is not * preceded by whitespace or a prefix op if it is. * * If neither of those symbols is valid, fall back to a regular operator. * * Used for `!`, `~` and `@`. */ static Symbol infix_or_varsym(Env *env, bool whitespace, Symbol prefix, Symbol tight) { SEQ(finish_if_valid(env, whitespace ? prefix : tight, "infix_or_varsym")); return finish_symop(env, VARSYM); } static Symbol qualified_op(Env *env) { if (qualified_name(env, is_symop) == QualifiedTarget) { SEQ(left_section_op(env, symop_lookahead(env))); return QUALIFIED_OP; } return FAIL; } // -------------------------------------------------------------------------------------------------------- // Token lookahead // -------------------------------------------------------------------------------------------------------- /** * Detect the start of a quasiquote: An opening bracket followed by an optional varid and a vertical bar, all without * whitespace in between. */ static bool is_qq_start(Env *env) { uint32_t end = advance_while(env, 1, quoter_char); return char_at(env, end, '|'); } /** * An end token is a keyword like `else` or `deriving` that can end a layout without newline or indent. */ static Lexed try_end_token(Env *env, const char * restrict target, Lexed match) { if (token(env, target)) return match; else return LNothing; } /** * Check that a symop consists only of minuses after the second character. */ static bool only_minus(Env *env) { uint32_t i = 2; while (peek(env, i) == '-') i++; return !symop_char(peek(env, i)); } /** * Check that a symop consists only of minuses, making it a comment herald. */ static bool line_comment_herald(Env *env) { return seq(env, "--") && only_minus(env); } static Lexed lex_cpp(Env *env) { switch(cpp_directive(env)) { case CppElse: return LCppElse; case CppNothing: return LNothing; default: return LCpp; } } /** * Lex pragmas, comments and CPP. */ static Lexed lex_extras(Env *env, bool bol) { switch (peek0(env)) { case '{': if (char1(env, '-')) return char2(env, '#') ? LPragma : LBlockComment; break; case '#': if (bol) return lex_cpp(env); break; case '-': if (line_comment_herald(env)) return LLineComment; break; default: break; } return LNothing; } /** * The main lexing entry point, branching on the first character, then advancing as far as necessary to identify all * interesting tokens. */ static Lexed lex(Env *env, bool bol) { SEQ(lex_extras(env, bol)); if (symop_char(peek0(env))) SEQ(lex_symop(env)); else switch (peek0(env)) { case 'w': return try_end_token(env, "where", LWhere); case 'i': return try_end_token(env, "in", LIn); case 't': return try_end_token(env, "then", LThen); case 'e': return try_end_token(env, "else", LElse); case 'd': return try_end_token(env, "deriving", LDeriving); case 'm': if ((uninitialized(env) || in_module_header(env)) && token(env, "module")) return LModule; break; case '{': return LBraceOpen; case '}': return LBraceClose; case ';': return LSemi; case '`': return LTick; case '[': if (valid(env, QQ_START) && is_qq_start(env)) return LBracketOpen; break; case ']': case ')': case ',': return LTexpCloser; default: if (is_conid_start_char(peek0(env))) return LUpper; break; } return LNothing; } // -------------------------------------------------------------------------------------------------------- // CPP // -------------------------------------------------------------------------------------------------------- /** * This tests for `#endif` directly after taking a line, so it only matches it at the first column. * Int finishes right before the `#endif`, so that pragma is parsed by `cpp_consume` in the next round. */ static Symbol cpp_else(Env *env, bool emit) { uint32_t nesting = 1; do { take_line_escaped_newline(env); if (emit) MARK("cpp_else"); S_ADVANCE; reset_lookahead(env); switch (cpp_directive(env)) { case CppStart: nesting++; break; case CppEnd: nesting--; break; default: break; } } while (not_eof(env) && nesting > 0); if (emit) return finish(CPP, "cpp-else"); else return FAIL; } static Symbol cpp_line(Env *env) { take_line_escaped_newline(env); return finish_marked(env, CPP, "cpp"); } // -------------------------------------------------------------------------------------------------------- // Comments // -------------------------------------------------------------------------------------------------------- /** * Distinguish between haddocks and plain comments by matching on the first non-whitespace character. */ static Symbol comment_type(Env *env) { uint32_t i = 2; while (peek(env, i) == '-') i++; while (not_eof(env)) { int32_t c = peek(env, i++); if (c == '|' || c == '^') return HADDOCK; else if (!is_space_char(c)) break; } return COMMENT; } /** * Inline comments extend over all consecutive lines that start with comments. * Could be improved by requiring equal indent. */ static Symbol inline_comment(Env *env) { Symbol sym = comment_type(env); do { take_line(env); MARK("inline comment"); S_ADVANCE; reset_lookahead(env); } while (line_comment_herald(env)); return sym; } static uint32_t consume_block_comment(Env *env, uint32_t col) { uint32_t level = 0; for (;;) { if (is_eof(env)) return col; col++; switch (PEEK) { case '{': S_ADVANCE; if (PEEK == '-') { S_ADVANCE; col++; level++; } break; case '-': S_ADVANCE; if (PEEK == '}') { S_ADVANCE; col++; if (level == 0) return col; level--; } break; NEWLINE_CASES: S_ADVANCE; col = 0; break; case '\t': S_ADVANCE; col += 7; break; default: S_ADVANCE; break; } } } /** * Since {- -} comments can be nested arbitrarily, this has to keep track of how many have been opened, so that the * outermost comment isn't closed prematurely. */ static Symbol block_comment(Env *env) { Symbol sym = comment_type(env); consume_block_comment(env, env->state->lookahead.size); return finish_marked(env, sym, "block_comment"); } // -------------------------------------------------------------------------------------------------------- // Pragma // -------------------------------------------------------------------------------------------------------- static bool consume_pragma(Env *env) { if (seq(env, "{-#")) { while (!seq(env, "#-}") && not_eof(env)) { reset_lookahead(env); advance_over(env, 0); } return true; } return false; } /** * Since pragmas can occur anywhere, like comments, but contrarily determine indentation when occurring at the beginning * of a line in layouts, this sets `NResume` to continue newline processing with the indent of the pragma. * * If the pragma is followed by newline, this only ensures that no semicolon is emitted (since this rule is run before * `semicolon` and `NResume` restarts lookahead). * * Otherwise it ensures that the following token is treated as a layout element with the correct indent. */ static Symbol pragma(Env *env) { if (consume_pragma(env)) { MARK("pragma"); if (env->state->newline.state != NInactive) env->state->newline.state = NResume; return finish(PRAGMA, "newline"); } return FAIL; } // -------------------------------------------------------------------------------------------------------- // Quasiquote // -------------------------------------------------------------------------------------------------------- static Symbol qq_body(Env *env) { for (;;) { if (is_eof(env)) return finish(QQ_BODY, "qq_body"); else if (PEEK == 0x27e7) { return finish_marked(env, QQ_BODY, "qq_body"); } else if (PEEK == '|') { MARK("qq_body"); S_ADVANCE; if (PEEK == ']') { return finish(QQ_BODY, "qq_body"); } } else S_ADVANCE; } } // -------------------------------------------------------------------------------------------------------- // Semicolon // -------------------------------------------------------------------------------------------------------- /** * When encountering explicit semicolons, we want to ensure that a subsequent newline doesn't trigger a layout * semicolon, so we set `skip_semi`. * If the next symbol is not a newline (and not another semicolon), the scanner will immediate end up in * `resolve_semicolon`, matching the condition, where we unset the flag to avoid a mid-line semicolon from influencing * an unrelated newline. * * Take this example: * * > a = 1;; * > b = 2 * > ;;c = 3 * * At the first semicolon, `explicit_semicolon` is called (conditioned on `LSemi` in `process_token_interior`) and * SEMICOLON is valid, so the flag is set. * The scanner will be called again immediately without advancing, and first enter `resolve_semicolon`, which does * nothing because the next token is still `LSemi`. * Next it will enter `explicit_semicolon` again. * SEMICOLON is valid, but since the flag is set we fall through and defer to internal lexing. * The grammar advances into `semi` (in `util.js`), which causes SEMICOLON to become invalid. * The scanner is executed before the second semicolon, where both functions skip again, this time additionally because * SEMICOLON is now invalid. * * In the next scan, the newline branch is taken in `scan`, so this function is not executed again. * Newline lookahead finds the next line to begin at column 0, which would usually trigger a layout semicolon in * `semicolon`, but that is inhibited by `skip_semi`, so the scan only skips whitespace and resets the newline state, * which unsets `skip_semi` again. * In the following scan, the conditions for both functions are unfulfilled, so parsing continues regularly until the * next newline. * * Newline lookahead now encounters the third semicolon on the next line and sets `no_semi`, which supersedes * `skip_semi` and prohibits layout semicolon irreversibly, so the explicit semicolons are parsed by the grammar. * * Now consider an inline semicolon: * * > f = let * > a = 1; b = 2 * > c = 3; {- x -} * > d = 4 * > in c * * When the semicolon is lexed, `explicit_semicolon` sets `skip_semi`. * If we would not reset it until the newline, no layout semicolon would be generated before `c`, resulting in a parse * error at `=`. * Therefore, `resolve_semicolon` unsets `skip_semi` when lexing `b`, triggered by `skip_semi` being set and the next * token not being `LSemi`. * * The semicolon after `c = 3` is followed by a comment, so it is unclear if there is going to be another layout element * in the same line. * If there is none, the situation is the same as in the first example's first line; if another layout element were to * follow, `skip_semi` would need to be reset like in this example's first line. * Therefore, `resolve_semicolon` also keeps the flag as it is in this case. */ static Symbol explicit_semicolon(Env *env) { if (valid(env, SEMICOLON) && !env->state->newline.skip_semi) { env->state->newline.skip_semi = true; return update_state("explicit semicolon enable"); } return FAIL; } static Symbol resolve_semicolon(Env *env, Lexed next) { if (env->state->newline.skip_semi) { switch(next) { case LLineComment: case LBlockComment: case LPragma: case LSemi: break; default: env->state->newline.skip_semi = false; return update_state("explicit semicolon disable"); } } return FAIL; } /** * Generate a layout semicolon after a newline if the indent is less or equal to the current layout's indent, unless: * * - The current context doesn't use layout semicolons, which is the case for explicit brace layouts, tuple expressions, * the module header and multi-way if layouts. * * - `no_semi` was set because newline lookahead found an explicit semicolon in the next line, or this function was * executed before for the same newline. * * - `skip_semi` was set because the previous line ended with an explicit semicolon. */ static Symbol semicolon(Env *env) { if ( is_semicolon_context(env) && !(env->state->newline.no_semi || env->state->newline.skip_semi) && indent_lesseq(env, env->state->newline.indent) ) { env->state->newline.no_semi = true; return finish(SEMICOLON, "newline"); } else return FAIL; } // -------------------------------------------------------------------------------------------------------- // High-level `Lexed` dispatch // -------------------------------------------------------------------------------------------------------- /** * Process a `Lexed` token if it results in a layout end or an extra. * * This is called by `newline_post` before marking, so the actions must not fail after advancing. */ static Symbol process_token_safe(Env *env, Lexed next) { switch (next) { case LWhere: return end_layout_where(env); case LIn: return end_layout_in(env); case LThen: case LElse: return end_layout(env, "then/else"); case LDeriving: return end_layout_deriving(env); case LBar: if (!valid(env, BAR)) return end_layout(env, "bar"); break; case LPragma: return pragma(env); case LBlockComment: return block_comment(env); case LLineComment: return inline_comment(env); case LCppElse: return cpp_else(env, true); case LCpp: return cpp_line(env); case LSymop: case LTick: case LHash: return end_layout_infix(env); case LUnboxedClose: SEQ(token_end_layout_texp(env)); return end_layout_infix(env); case LArrow: if (!valid(env, ARROW)) return token_end_layout_texp(env); break; case LTexpCloser: return token_end_layout_texp(env); case LQuoteClose: return end_layout(env, "quote bracket"); break; default: break; } return FAIL; } /** * Process a `Lexed` token if it results in a symbolic operator. */ static Symbol process_token_symop(Env *env, bool whitespace, Lexed next) { switch (next) { case LDotDot: SEQ(finish_if_valid(env, DOTDOT, "symop")); return tight_op(env, whitespace, QUAL_DOT); case LDotId: SEQ(finish_if_valid(env, whitespace ? PREFIX_DOT : TIGHT_DOT, "symop")); return tight_op(env, whitespace, QUAL_DOT); case LDotSymop: return tight_or_varsym(env, whitespace, QUAL_DOT); case LDotOpen: return prefix_or_varsym(env, whitespace, PREFIX_DOT); case LBang: return infix_or_varsym(env, whitespace, PREFIX_BANG, TIGHT_BANG); case LTilde: return infix_or_varsym(env, whitespace, PREFIX_TILDE, TIGHT_TILDE); case LAt: return infix_or_varsym(env, whitespace, PREFIX_AT, TIGHT_AT); case LPercent: return prefix_or_varsym(env, whitespace, PREFIX_PERCENT); case LSymop: if (char0(env, ':')) return finish_symop(env, CONSYM); else return finish_symop(env, VARSYM); // The following are handled here despite not being purely symop tokens because `process_token_symop` is executed // last, and these handlers all have potentially quite far lookahead and can fail. case LSymopSpecial: SEQ(left_section_op(env, symop_lookahead(env))); if (valid(env, MINUS) && match_symop(env, "-")) return finish(MINUS, "symop"); break; case LUnboxedClose: case LHash: return left_section_op(env, symop_lookahead(env)); case LTick: return left_section_ticked(env); case LUpper: if (valid(env, QUALIFIED_OP) || valid(env, LEFT_SECTION_OP)) SEQ(qualified_op(env)); break; default: break; } return FAIL; } static Symbol process_token_splice(Env *env, Lexed next) { switch (next) { case LDollar: return finish_if_valid(env, SPLICE, "symop"); default: break; } return FAIL; } /** * Process a `Lexed` token for an interior position. */ static Symbol process_token_interior(Env *env, Lexed next) { switch (next) { case LBraceClose: SEQ(end_layout_brace(env)); return token_end_layout_texp(env); // Skip layout start case LModule: return FAIL; case LSemi: return explicit_semicolon(env); case LBracketOpen: return finish(QQ_START, "qq_start"); default: break; } SEQ(process_token_safe(env, next)); return start_layout_interior(env, next); } /** * Process a `Lexed` token to initialize the context stack. */ static Symbol process_token_init(Env *env, uint32_t indent, Lexed next) { switch (next) { case LModule: push_context(env, ModuleHeader, 0); return update_state("init"); case LBraceOpen: advance_over(env, 0); MARK("init brace"); push_context(env, Braces, indent); return finish(START_EXPLICIT, "init"); default: push_context(env, DeclLayout, indent); return finish(START, "init"); } } // -------------------------------------------------------------------------------------------------------- // Newline actions // -------------------------------------------------------------------------------------------------------- /** * `NoSpace` + `newline_init()` means that we're at the very beginning of the file, where we start in `NResume` mode * without a newline character that can tell us where we are. */ static Symbol newline_extras(Env *env, Space space) { bool bol = space == BOL || (space == NoSpace && newline_init(env)); Lexed next = lex_extras(env, bol); dbg("newline extras token: %s\n", token_names[next]); return process_token_safe(env, next); } // Don't finish newline processing before pragmas – they are indicators of layout indent, but since they are extras, // they cannot consume a semicolon, so when there's a pragma on a line of its own, we would get two semicolons if we // finished here. // It's guaranteed that the newline state was committed at least once because `newline_lookahead` sets `unsafe` when // finding a pragma. static Symbol newline_process(Env *env) { dbg("newline post\n"); uint32_t indent = env->state->newline.indent; Lexed end = env->state->newline.end; SEQ(end_layout_indent(env)); SEQ(process_token_safe(env, end)); Space space = skip_whitespace(env); MARK("newline_post"); if (env->state->newline.unsafe) SEQ(newline_extras(env, space)); if (!env->state->newline.eof) SEQ(start_layout_newline(env)); // TODO it is only necessary to run this late because of very few situations, like nondecreasing indent. // But it has the consequence that whitespace is included in the parent in nested layouts. // Maybe there's a way to run it before and after `start_layout_newline` with conditions. SEQ(semicolon(env)); reset_newline(env); if (uninitialized(env)) SEQ(process_token_init(env, indent, end)); else { SEQ(process_token_symop(env, true, end)); SEQ(process_token_splice(env, end)); } return update_state("newline final"); } static Symbol newline_post(Env *env) { Symbol res = newline_process(env); if (newline_init(env)) env->state->newline.state = NProcess; return res; } /** * Repeatedly lex lookahead until encountering something that is neither a comment nor CPP, skipping whitespace and * newlines in between. */ static void newline_lookahead(Env *env, Newline *newline) { for (;;) { // Using `peek0` to look for whitespace requires the lookahead buffer to have been reset immediately before this // statement – so before the call to this function or at the end of the for loop body. // The reason this isn't using `lexer->lookahead` is that the function may be called at an interior position, to // skip extras. switch (peek0(env)) { NEWLINE_CASES: skip_over(env, 0); newline->indent = 0; break; case '\t': skip_over(env, 0); newline->indent += 8; break; default: if (is_space_char(peek0(env))) { skip_over(env, 0); newline->indent++; break; } newline->end = lex(env, newline->indent == 0); dbg("newline token: %s, %lc\n", token_names[newline->end], peek0(env)); // Newlines without extras are only safe if `lex` didn't advance the lexer over non-whitespace. newline->unsafe |= !no_lookahead(env); switch (newline->end) { case LEof: newline->indent = 0; newline->eof = true; return; // If/then blocks can have semicolons, but don't have a layout. // Allowing layout semicolons costs 100kB. case LThen: case LElse: case LSemi: newline->no_semi = true; return; case LBlockComment: newline->indent = consume_block_comment(env, newline->indent + 2); break; case LLineComment: newline->indent = 0; take_line(env); break; case LCppElse: cpp_else(env, false); take_line_escaped_newline(env); break; case LCpp: take_line_escaped_newline(env); break; default: return; } } reset_lookahead(env); } } /** * Perform newline lookahead, then either finish the run if the position was advanced into the next token, or directly * start newline processing if not. */ static Symbol newline_start(Env *env) { dbg("newline lookahead\n"); env->state->newline.state = NInit; newline_lookahead(env, &env->state->newline); if (env->state->newline.unsafe) return update_state("newline lookahead"); else return newline_post(env); } /** * Perform newline lookahead with preset indent, used at the beginning of a file and after pragmas. */ static Symbol newline_resume(Env *env) { dbg("newline resume\n"); uint32_t indent = env->state->newline.indent; // Skip space between the pragma end and the next token, which might be the first real token (or another pragma or // comment, or newline). // We don't want to count the space as indent. skip_space(env); reset_newline(env); env->state->newline.indent = indent; return newline_start(env); } // -------------------------------------------------------------------------------------------------------- // Constraints // -------------------------------------------------------------------------------------------------------- /** * The following mechanism avoids the conflict between types and classes. * Consider this situation: * * > data A = B b % C => D d :+ E * > data E = F f => G g * * After the `=`, a diverse set of constructs are valid. * * - Data constructor * - Infix `D d :+ E` -> `(type/name) (type/variable) (constructor_operator) (type/name)` * - Prefix `G g` -> `(name) (type/variable)` * - Context * - Infix `B b % C` -> `(type/name) (type/variable) (operator) (type/name)` * - Prefix `F f` -> `(constraint/name) (type/variable)` * * Each of these starts with a `(name)` with different reduction rules that can only be resolved when the arrow or a * data constructor-ending token is encountered. * The conflict between `D` and `G` is an additional hurdle that is not addressed here. * * Constraint lookahead scans ahead until it finds `=>` or a clear rejection criterion like `=` or (layout) semicolon, * emitting `_cond_context` to unlock the rules `_qtype_context`, `context` and `_ctr_context`. * * However, even the two context variants conflict, since infix classes have types in their operands, while a prefix * constraint starts with a class name. * To mitigate this, constraint lookahead additionally emits `_cond_infix` when it encounters an infix operator. * This symbol is only emitted when `_cond_context` is not valid (because it was parsed right before) or because no `=>` * is encountered afterwards (because the current position is in parentheses). * This only works because infix classes are localized within contexts – disambiguating all infix types like this is * impossible without completely restructuring the grammar. * * Note that this problem could easily be avoided by parsing all contexts as types, accepting that queries for class * names would be more verbose and couldn't match more complex constraints. * Furthermore, a much simpler fix would be a runtime conflict, which has the potential to result in randomly incorrect * parse trees. * * Similarly to contexts, data constructor heads have infix type-related conflicts that aren't as severe but can easily * piggyback on this mechanism, so they are included. * * Lastly, associated type families and instances conflict because they can both be heralded by `type` alone, so the * decision to reduce to type head or instance head nodes is informed by the presence of `::` or `=` without `|`. */ /** * Result of constraint lookahead. */ typedef enum { // Continue searching CtrUndecided, // Clear evidence found that no context or infix class is ahead. CtrImpossible, // The context arrow `=>` was found. CtrArrowFound, // An infix operator was found. CtrInfixFound, // An `=` was found. CtrEqualsFound, // A `|` was found. CtrBarFound, } CtrResult; #ifdef TREE_SITTER_DEBUG static const char *ctr_result_names[] = { "undecided", "impossible", "arrow", "infix", "equals", "bar", }; #endif /** * Constraint lookahead state. */ typedef struct { // The amount of characters to skip after an iteration. // For example, after lexing a `conid` the next token can be lexed at the end of the identifier. uint32_t reset; // The number of nested brackets. // When this is nonzero, end tokens are not treated as pertaining to the current expression. uint32_t brackets; // A context arrow was found. bool context; // An infix operator was found. bool infix; bool data_infix; bool type_instance; } CtrState; /** * Increment the bracket count. */ static CtrResult ctr_bracket_open(CtrState *state) { state->brackets++; state->reset = 1; return CtrUndecided; } /** * Decrement the bracket count. * If the count was zero already, parsing started inside of brackets that are closed here, so lookahead is terminated. */ static CtrResult ctr_bracket_close(CtrState *state) { if (state->brackets == 0) return CtrImpossible; state->brackets--; state->reset = 1; return CtrUndecided; } /** * If the given token is ahead, terminate lookahead unsuccessfully. */ static CtrResult ctr_stop_on_token(Env *env, const char * restrict target) { return token(env, target) ? CtrImpossible : CtrUndecided; } /** * Check if the lexed token is `=>` or an infix operator. * * This is performed only when the current position is not in a bracketed expression, i.e. at top level relative to the * initial lexer position. * Otherwise the token belongs to a later, nested expression. * * Certain tokens are proof that no context can start at the current position, like `::` or `forall`, so lookahead is * terminated. * It is still possible that an infix class can be parsed, for example in this type when starting at the at `C` and * terminating at `::`: * > `a :: (C + D :: Constraint) => E` */ static CtrResult ctr_top(Env *env, Lexed next) { switch (next) { case LCArrow: return CtrArrowFound; case LSymop: case LSymopSpecial: case LTilde: case LTick: return CtrInfixFound; case LBar: return CtrBarFound; case LArrow: case LWhere: case LDotDot: case LSemi: break; case LTexpCloser: switch (peek0(env)) { case '=': return CtrEqualsFound; default: break; } break; default: switch (peek0(env)) { // Symop is processed in `ctr_lookahead_step`, so `=` and `::` can not be a prefix case '=': return CtrEqualsFound; case 0x2200: // ∀ break; case ':': if (char1(env, ':')) break; return CtrUndecided; case 'f': SEQ(ctr_stop_on_token(env, "forall")); return ctr_stop_on_token(env, "family"); case 'i': return ctr_stop_on_token(env, "instance"); default: return CtrUndecided; } } return CtrImpossible; } /** * Process a lexed token for constraint lookahead: * - Update bracket nesting count * - Advance over pragmas, strings, chars and conids * - Set the reset index for certain tokens * * If the token wasn't identified to be irrelevant for the lookahead result, and the current bracket nesting level is * zero, call `ctr_top`. */ static CtrResult ctr_lookahead_step(Env *env, CtrState *state, Lexed next) { state->reset = 1; switch (next) { case LBraceClose: return ctr_bracket_close(state); case LUnboxedClose: SEQ(ctr_bracket_close(state)); state->reset = 2; return CtrUndecided; case LBraceOpen: return ctr_bracket_open(state); case LSymopSpecial: case LSymop: state->reset = symop_lookahead(env); break; case LUpper: state->reset = conid(env); return CtrUndecided; case LDotId: return CtrUndecided; case LPragma: if (consume_pragma(env)) state->reset = 3; return CtrUndecided; case LTexpCloser: case LNothing: switch (peek0(env)) { case ')': case ']': return ctr_bracket_close(state); case '(': case '[': return ctr_bracket_open(state); case '"': state->reset = take_string_literal(env); return CtrUndecided; case '\'': state->reset = take_char_literal(env); return CtrUndecided; default: if (varid_start_char(peek0(env))) state->reset = advance_while(env, 1, is_id_char); break; } default: break; } if (state->brackets != 0) return CtrUndecided; return ctr_top(env, next); } /** * Main loop for context lookahead. * * Perform newline lookahead and terminate if the end of the current layout element is encountered. * Otherwise use the new end token to detect a context arrow or infix operator. * If no termination criterion is fulfilled, reset lookahead and repeat. * * Newline lookahead skips over extras. * * A context arrow is always a termination criterion; an infix operator only if CONTEXT isn't valid. */ static Symbol constraint_lookahead(Env *env) { dbg("type lookahead\n"); CtrState state = {.reset = 0}; bool done = false; while (!done && not_eof(env)) { // Setting indent to 99999 only to not trigger the following termination condition when no newline was advanced over Newline newline = {.state = 0, .indent = 99999}; newline_lookahead(env, &newline); if (newline.indent <= current_indent(env) && current_context(env) != Braces) break; CtrResult result = ctr_lookahead_step(env, &state, newline.end); dbg("type: %lc, %s\n", peek0(env), ctr_result_names[result]); switch (result) { case CtrArrowFound: state.context = true; done = true; break; case CtrInfixFound: if (char0(env, ':') || char0(env, '`')) state.data_infix = true; state.infix = true; // Context has precedence, e.g. `instance a + a => A` finds `+` first and would treat that as the class name of // the head, then failing on the right operand. done = !valid(env, CONTEXT); break; case CtrEqualsFound: done = !valid(env, TYPE_INSTANCE); state.type_instance = true; break; case CtrBarFound: done = true; state.type_instance = false; break; case CtrImpossible: done = true; case CtrUndecided: break; } reset_lookahead_to(env, state.reset); state.reset = 0; } if (state.context) SEQ(finish_if_valid(env, CONTEXT, "ctr")); if (state.infix) SEQ(finish_if_valid(env, INFIX, "ctr")); if (state.data_infix) SEQ(finish_if_valid(env, DATA_INFIX, "ctr")); if (state.type_instance) SEQ(finish_if_valid(env, TYPE_INSTANCE, "ctr")); return FAIL; } // -------------------------------------------------------------------------------------------------------- // Actions that are executed for interior positions // -------------------------------------------------------------------------------------------------------- static Symbol process_token_constraint(Env *env) { if ( valid(env, CONTEXT) || valid(env, INFIX) || valid(env, DATA_INFIX) || valid(env, TYPE_INSTANCE) ) return constraint_lookahead(env); return FAIL; } static Symbol interior(Env *env, bool whitespace) { Lexed next = lex(env, false); dbg("interior, column %d, ws %d, token %s\n", column(env), whitespace, token_names[next]); SEQ(resolve_semicolon(env, next)); SEQ(process_token_interior(env, next)); SEQ(process_token_symop(env, whitespace, next)); SEQ(process_token_constraint(env)); SEQ(process_token_splice(env, next)); return FAIL; } // -------------------------------------------------------------------------------------------------------- // Initial actions // -------------------------------------------------------------------------------------------------------- /** * These are conditioned only on symbols and don't advance, except for `qq_body`, which cannot fail. */ static Symbol pre_ws_commands(Env *env) { SEQ(texp_context(env)); SEQ(start_brace(env)); SEQ(end_brace(env)); // Leading whitespace must be included in the node. if (valid(env, QQ_BODY)) return qq_body(env); if (newline_active(env)) SEQ(newline_post(env)); else if (env->state->newline.state == NResume) SEQ(newline_resume(env)); return FAIL; } static Symbol scan_main(Env *env) { MARK("main"); SEQ(pre_ws_commands(env)); bool whitespace = skip_space(env); if (is_newline(PEEK)) return newline_start(env); else if (not_eof(env)) return interior(env, whitespace); return FAIL; } #ifdef TREE_SITTER_DEBUG static Symbol scan_debug(Env *env) { if (debug_init(env)) return update_state("debug init parse buffer"); Symbol result = scan_main(env); debug_finish(env, result); return result; } #endif static bool process_result(Env *env, Symbol result) { if (result == FAIL && is_eof(env) && no_lookahead(env)) { MARK("eof whitespace"); // Inlined `end_layout` because of perf glitch if (valid(env, END)) result = end_layout_unchecked(env, "eof"); else if (valid(env, SEMICOLON)) result = finish(SEMICOLON, "eof"); else { result = force_end_context(env); if (result == FAIL) { dbg("eof | context cap: %d | lookahead cap: %d | parse cap: %d\n", env->state->contexts.capacity, env->state->lookahead.capacity, env->state->parse.capacity);} } } return set_result_symbol(env, result); } static bool scan(Env *env) { if(after_error(env)) { dbg("error recovery\n"); return false; } #ifdef TREE_SITTER_DEBUG Symbol result = scan_debug(env); #else Symbol result = scan_main(env); #endif return process_result(env, result); } // -------------------------------------------------------------------------------------------------------- // API // -------------------------------------------------------------------------------------------------------- typedef struct { unsigned contexts; Newline newline; #ifdef TREE_SITTER_DEBUG unsigned parse; #endif } Persist; /** * This function allocates the persistent state of the parser that is passed into the other API functions. */ void *tree_sitter_haskell_external_scanner_create() { State *state = ts_calloc(1, sizeof(State)); array_reserve(&state->contexts, 8); array_reserve(&state->lookahead, 8); #ifdef TREE_SITTER_DEBUG array_reserve(&state->parse, 20); #endif return state; } /** * Main logic entry point. * Since the state is a singular vector, it can just be cast and used directly. */ bool tree_sitter_haskell_external_scanner_scan(void *payload, TSLexer *lexer, const bool *valid_symbols) { Env env = env_new(lexer, valid_symbols, (State*) payload); return scan(&env); } unsigned tree_sitter_haskell_external_scanner_serialize(void *payload, char *buffer) { State *state = (State *) payload; Persist persist = {.contexts = state->contexts.size, .newline = state->newline}; #ifdef TREE_SITTER_DEBUG persist.parse = state->parse.size; #endif unsigned contexts_size = persist.contexts * sizeof(Context); memcpy(buffer, &persist, sizeof(Persist)); unsigned to_copy = sizeof(Persist) + contexts_size; if (to_copy > TREE_SITTER_SERIALIZATION_BUFFER_SIZE) return 0; memcpy(buffer + sizeof(Persist), state->contexts.contents, contexts_size); #ifdef TREE_SITTER_DEBUG to_copy = serialize_parse_lines(buffer + sizeof(Persist) + contexts_size, &state->parse, to_copy); #endif return to_copy; } void tree_sitter_haskell_external_scanner_deserialize(void *payload, const char *buffer, unsigned length) { State *state = (State *) payload; Persist p; Persist *persist; if (length > 0) persist = (Persist *) buffer; else { p = (Persist) {.contexts = 0}; persist = &p; persist->newline.state = NResume; } unsigned contexts_size = persist->contexts * sizeof(Context); state->newline = persist->newline; array_reserve(&state->contexts, persist->contexts); state->contexts.size = persist->contexts; if (length > 0) memcpy(state->contexts.contents, buffer + sizeof(Persist), contexts_size); state->lookahead.size = 0; state->lookahead.offset = 0; array_reserve(&state->lookahead, 8); #ifdef TREE_SITTER_DEBUG if (length > 0) deserialize_parse_lines(buffer + sizeof(Persist) + contexts_size, &state->parse, persist->parse); #endif } void tree_sitter_haskell_external_scanner_destroy(void *payload) { State *state = (State*) payload; #ifdef TREE_SITTER_DEBUG palette(); ParseLines *parse = &state->parse; for (unsigned i = 0; i < parse->size; i++) array_delete(array_get(parse, i)); array_delete(parse); #endif array_delete(&state->contexts); array_delete(&state->lookahead); ts_free(state); } ================================================ FILE: src/tree_sitter/alloc.h ================================================ #ifndef TREE_SITTER_ALLOC_H_ #define TREE_SITTER_ALLOC_H_ #ifdef __cplusplus extern "C" { #endif #include #include #include // Allow clients to override allocation functions #ifdef TREE_SITTER_REUSE_ALLOCATOR extern void *(*ts_current_malloc)(size_t size); extern void *(*ts_current_calloc)(size_t count, size_t size); extern void *(*ts_current_realloc)(void *ptr, size_t size); extern void (*ts_current_free)(void *ptr); #ifndef ts_malloc #define ts_malloc ts_current_malloc #endif #ifndef ts_calloc #define ts_calloc ts_current_calloc #endif #ifndef ts_realloc #define ts_realloc ts_current_realloc #endif #ifndef ts_free #define ts_free ts_current_free #endif #else #ifndef ts_malloc #define ts_malloc malloc #endif #ifndef ts_calloc #define ts_calloc calloc #endif #ifndef ts_realloc #define ts_realloc realloc #endif #ifndef ts_free #define ts_free free #endif #endif #ifdef __cplusplus } #endif #endif // TREE_SITTER_ALLOC_H_ ================================================ FILE: src/tree_sitter/array.h ================================================ #ifndef TREE_SITTER_ARRAY_H_ #define TREE_SITTER_ARRAY_H_ #ifdef __cplusplus extern "C" { #endif #include "./alloc.h" #include #include #include #include #include #ifdef _MSC_VER #pragma warning(disable : 4101) #elif defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-variable" #endif #define Array(T) \ struct { \ T *contents; \ uint32_t size; \ uint32_t capacity; \ } /// Initialize an array. #define array_init(self) \ ((self)->size = 0, (self)->capacity = 0, (self)->contents = NULL) /// Create an empty array. #define array_new() \ { NULL, 0, 0 } /// Get a pointer to the element at a given `index` in the array. #define array_get(self, _index) \ (assert((uint32_t)(_index) < (self)->size), &(self)->contents[_index]) /// Get a pointer to the first element in the array. #define array_front(self) array_get(self, 0) /// Get a pointer to the last element in the array. #define array_back(self) array_get(self, (self)->size - 1) /// Clear the array, setting its size to zero. Note that this does not free any /// memory allocated for the array's contents. #define array_clear(self) ((self)->size = 0) /// Reserve `new_capacity` elements of space in the array. If `new_capacity` is /// less than the array's current capacity, this function has no effect. #define array_reserve(self, new_capacity) \ _array__reserve((Array *)(self), array_elem_size(self), new_capacity) /// Free any memory allocated for this array. Note that this does not free any /// memory allocated for the array's contents. #define array_delete(self) _array__delete((Array *)(self)) /// Push a new `element` onto the end of the array. #define array_push(self, element) \ (_array__grow((Array *)(self), 1, array_elem_size(self)), \ (self)->contents[(self)->size++] = (element)) /// Increase the array's size by `count` elements. /// New elements are zero-initialized. #define array_grow_by(self, count) \ do { \ if ((count) == 0) break; \ _array__grow((Array *)(self), count, array_elem_size(self)); \ memset((self)->contents + (self)->size, 0, (count) * array_elem_size(self)); \ (self)->size += (count); \ } while (0) /// Append all elements from one array to the end of another. #define array_push_all(self, other) \ array_extend((self), (other)->size, (other)->contents) /// Append `count` elements to the end of the array, reading their values from the /// `contents` pointer. #define array_extend(self, count, contents) \ _array__splice( \ (Array *)(self), array_elem_size(self), (self)->size, \ 0, count, contents \ ) /// Remove `old_count` elements from the array starting at the given `index`. At /// the same index, insert `new_count` new elements, reading their values from the /// `new_contents` pointer. #define array_splice(self, _index, old_count, new_count, new_contents) \ _array__splice( \ (Array *)(self), array_elem_size(self), _index, \ old_count, new_count, new_contents \ ) /// Insert one `element` into the array at the given `index`. #define array_insert(self, _index, element) \ _array__splice((Array *)(self), array_elem_size(self), _index, 0, 1, &(element)) /// Remove one element from the array at the given `index`. #define array_erase(self, _index) \ _array__erase((Array *)(self), array_elem_size(self), _index) /// Pop the last element off the array, returning the element by value. #define array_pop(self) ((self)->contents[--(self)->size]) /// Assign the contents of one array to another, reallocating if necessary. #define array_assign(self, other) \ _array__assign((Array *)(self), (const Array *)(other), array_elem_size(self)) /// Swap one array with another #define array_swap(self, other) \ _array__swap((Array *)(self), (Array *)(other)) /// Get the size of the array contents #define array_elem_size(self) (sizeof *(self)->contents) /// Search a sorted array for a given `needle` value, using the given `compare` /// callback to determine the order. /// /// If an existing element is found to be equal to `needle`, then the `index` /// out-parameter is set to the existing value's index, and the `exists` /// out-parameter is set to true. Otherwise, `index` is set to an index where /// `needle` should be inserted in order to preserve the sorting, and `exists` /// is set to false. #define array_search_sorted_with(self, compare, needle, _index, _exists) \ _array__search_sorted(self, 0, compare, , needle, _index, _exists) /// Search a sorted array for a given `needle` value, using integer comparisons /// of a given struct field (specified with a leading dot) to determine the order. /// /// See also `array_search_sorted_with`. #define array_search_sorted_by(self, field, needle, _index, _exists) \ _array__search_sorted(self, 0, _compare_int, field, needle, _index, _exists) /// Insert a given `value` into a sorted array, using the given `compare` /// callback to determine the order. #define array_insert_sorted_with(self, compare, value) \ do { \ unsigned _index, _exists; \ array_search_sorted_with(self, compare, &(value), &_index, &_exists); \ if (!_exists) array_insert(self, _index, value); \ } while (0) /// Insert a given `value` into a sorted array, using integer comparisons of /// a given struct field (specified with a leading dot) to determine the order. /// /// See also `array_search_sorted_by`. #define array_insert_sorted_by(self, field, value) \ do { \ unsigned _index, _exists; \ array_search_sorted_by(self, field, (value) field, &_index, &_exists); \ if (!_exists) array_insert(self, _index, value); \ } while (0) // Private typedef Array(void) Array; /// This is not what you're looking for, see `array_delete`. static inline void _array__delete(Array *self) { if (self->contents) { ts_free(self->contents); self->contents = NULL; self->size = 0; self->capacity = 0; } } /// This is not what you're looking for, see `array_erase`. static inline void _array__erase(Array *self, size_t element_size, uint32_t index) { assert(index < self->size); char *contents = (char *)self->contents; memmove(contents + index * element_size, contents + (index + 1) * element_size, (self->size - index - 1) * element_size); self->size--; } /// This is not what you're looking for, see `array_reserve`. static inline void _array__reserve(Array *self, size_t element_size, uint32_t new_capacity) { if (new_capacity > self->capacity) { if (self->contents) { self->contents = ts_realloc(self->contents, new_capacity * element_size); } else { self->contents = ts_malloc(new_capacity * element_size); } self->capacity = new_capacity; } } /// This is not what you're looking for, see `array_assign`. static inline void _array__assign(Array *self, const Array *other, size_t element_size) { _array__reserve(self, element_size, other->size); self->size = other->size; memcpy(self->contents, other->contents, self->size * element_size); } /// This is not what you're looking for, see `array_swap`. static inline void _array__swap(Array *self, Array *other) { Array swap = *other; *other = *self; *self = swap; } /// This is not what you're looking for, see `array_push` or `array_grow_by`. static inline void _array__grow(Array *self, uint32_t count, size_t element_size) { uint32_t new_size = self->size + count; if (new_size > self->capacity) { uint32_t new_capacity = self->capacity * 2; if (new_capacity < 8) new_capacity = 8; if (new_capacity < new_size) new_capacity = new_size; _array__reserve(self, element_size, new_capacity); } } /// This is not what you're looking for, see `array_splice`. static inline void _array__splice(Array *self, size_t element_size, uint32_t index, uint32_t old_count, uint32_t new_count, const void *elements) { uint32_t new_size = self->size + new_count - old_count; uint32_t old_end = index + old_count; uint32_t new_end = index + new_count; assert(old_end <= self->size); _array__reserve(self, element_size, new_size); char *contents = (char *)self->contents; if (self->size > old_end) { memmove( contents + new_end * element_size, contents + old_end * element_size, (self->size - old_end) * element_size ); } if (new_count > 0) { if (elements) { memcpy( (contents + index * element_size), elements, new_count * element_size ); } else { memset( (contents + index * element_size), 0, new_count * element_size ); } } self->size += new_count - old_count; } /// A binary search routine, based on Rust's `std::slice::binary_search_by`. /// This is not what you're looking for, see `array_search_sorted_with` or `array_search_sorted_by`. #define _array__search_sorted(self, start, compare, suffix, needle, _index, _exists) \ do { \ *(_index) = start; \ *(_exists) = false; \ uint32_t size = (self)->size - *(_index); \ if (size == 0) break; \ int comparison; \ while (size > 1) { \ uint32_t half_size = size / 2; \ uint32_t mid_index = *(_index) + half_size; \ comparison = compare(&((self)->contents[mid_index] suffix), (needle)); \ if (comparison <= 0) *(_index) = mid_index; \ size -= half_size; \ } \ comparison = compare(&((self)->contents[*(_index)] suffix), (needle)); \ if (comparison == 0) *(_exists) = true; \ else if (comparison < 0) *(_index) += 1; \ } while (0) /// Helper macro for the `_sorted_by` routines below. This takes the left (existing) /// parameter by reference in order to work with the generic sorting function above. #define _compare_int(a, b) ((int)*(a) - (int)(b)) #ifdef _MSC_VER #pragma warning(default : 4101) #elif defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic pop #endif #ifdef __cplusplus } #endif #endif // TREE_SITTER_ARRAY_H_ ================================================ FILE: src/tree_sitter/parser.h ================================================ #ifndef TREE_SITTER_PARSER_H_ #define TREE_SITTER_PARSER_H_ #ifdef __cplusplus extern "C" { #endif #include #include #include #define ts_builtin_sym_error ((TSSymbol)-1) #define ts_builtin_sym_end 0 #define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024 #ifndef TREE_SITTER_API_H_ typedef uint16_t TSStateId; typedef uint16_t TSSymbol; typedef uint16_t TSFieldId; typedef struct TSLanguage TSLanguage; #endif typedef struct { TSFieldId field_id; uint8_t child_index; bool inherited; } TSFieldMapEntry; typedef struct { uint16_t index; uint16_t length; } TSFieldMapSlice; typedef struct { bool visible; bool named; bool supertype; } TSSymbolMetadata; typedef struct TSLexer TSLexer; struct TSLexer { int32_t lookahead; TSSymbol result_symbol; void (*advance)(TSLexer *, bool); void (*mark_end)(TSLexer *); uint32_t (*get_column)(TSLexer *); bool (*is_at_included_range_start)(const TSLexer *); bool (*eof)(const TSLexer *); void (*log)(const TSLexer *, const char *, ...); }; typedef enum { TSParseActionTypeShift, TSParseActionTypeReduce, TSParseActionTypeAccept, TSParseActionTypeRecover, } TSParseActionType; typedef union { struct { uint8_t type; TSStateId state; bool extra; bool repetition; } shift; struct { uint8_t type; uint8_t child_count; TSSymbol symbol; int16_t dynamic_precedence; uint16_t production_id; } reduce; uint8_t type; } TSParseAction; typedef struct { uint16_t lex_state; uint16_t external_lex_state; } TSLexMode; typedef union { TSParseAction action; struct { uint8_t count; bool reusable; } entry; } TSParseActionEntry; typedef struct { int32_t start; int32_t end; } TSCharacterRange; struct TSLanguage { uint32_t version; uint32_t symbol_count; uint32_t alias_count; uint32_t token_count; uint32_t external_token_count; uint32_t state_count; uint32_t large_state_count; uint32_t production_id_count; uint32_t field_count; uint16_t max_alias_sequence_length; const uint16_t *parse_table; const uint16_t *small_parse_table; const uint32_t *small_parse_table_map; const TSParseActionEntry *parse_actions; const char * const *symbol_names; const char * const *field_names; const TSFieldMapSlice *field_map_slices; const TSFieldMapEntry *field_map_entries; const TSSymbolMetadata *symbol_metadata; const TSSymbol *public_symbol_map; const uint16_t *alias_map; const TSSymbol *alias_sequences; const TSLexMode *lex_modes; bool (*lex_fn)(TSLexer *, TSStateId); bool (*keyword_lex_fn)(TSLexer *, TSStateId); TSSymbol keyword_capture_token; struct { const bool *states; const TSSymbol *symbol_map; void *(*create)(void); void (*destroy)(void *); bool (*scan)(void *, TSLexer *, const bool *symbol_whitelist); unsigned (*serialize)(void *, char *); void (*deserialize)(void *, const char *, unsigned); } external_scanner; const TSStateId *primary_state_ids; }; static inline bool set_contains(TSCharacterRange *ranges, uint32_t len, int32_t lookahead) { uint32_t index = 0; uint32_t size = len - index; while (size > 1) { uint32_t half_size = size / 2; uint32_t mid_index = index + half_size; TSCharacterRange *range = &ranges[mid_index]; if (lookahead >= range->start && lookahead <= range->end) { return true; } else if (lookahead > range->end) { index = mid_index; } size -= half_size; } TSCharacterRange *range = &ranges[index]; return (lookahead >= range->start && lookahead <= range->end); } /* * Lexer Macros */ #ifdef _MSC_VER #define UNUSED __pragma(warning(suppress : 4101)) #else #define UNUSED __attribute__((unused)) #endif #define START_LEXER() \ bool result = false; \ bool skip = false; \ UNUSED \ bool eof = false; \ int32_t lookahead; \ goto start; \ next_state: \ lexer->advance(lexer, skip); \ start: \ skip = false; \ lookahead = lexer->lookahead; #define ADVANCE(state_value) \ { \ state = state_value; \ goto next_state; \ } #define ADVANCE_MAP(...) \ { \ static const uint16_t map[] = { __VA_ARGS__ }; \ for (uint32_t i = 0; i < sizeof(map) / sizeof(map[0]); i += 2) { \ if (map[i] == lookahead) { \ state = map[i + 1]; \ goto next_state; \ } \ } \ } #define SKIP(state_value) \ { \ skip = true; \ state = state_value; \ goto next_state; \ } #define ACCEPT_TOKEN(symbol_value) \ result = true; \ lexer->result_symbol = symbol_value; \ lexer->mark_end(lexer); #define END_STATE() return result; /* * Parse Table Macros */ #define SMALL_STATE(id) ((id) - LARGE_STATE_COUNT) #define STATE(id) id #define ACTIONS(id) id #define SHIFT(state_value) \ {{ \ .shift = { \ .type = TSParseActionTypeShift, \ .state = (state_value) \ } \ }} #define SHIFT_REPEAT(state_value) \ {{ \ .shift = { \ .type = TSParseActionTypeShift, \ .state = (state_value), \ .repetition = true \ } \ }} #define SHIFT_EXTRA() \ {{ \ .shift = { \ .type = TSParseActionTypeShift, \ .extra = true \ } \ }} #define REDUCE(symbol_name, children, precedence, prod_id) \ {{ \ .reduce = { \ .type = TSParseActionTypeReduce, \ .symbol = symbol_name, \ .child_count = children, \ .dynamic_precedence = precedence, \ .production_id = prod_id \ }, \ }} #define RECOVER() \ {{ \ .type = TSParseActionTypeRecover \ }} #define ACCEPT_INPUT() \ {{ \ .type = TSParseActionTypeAccept \ }} #ifdef __cplusplus } #endif #endif // TREE_SITTER_PARSER_H_ ================================================ FILE: src/unicode.h ================================================ #include #include static uint8_t bitmap_identifier_1[] = { 0xff,3,0xfe,0xff,0xff,7,0xfe,0xff,0xff,7,0,0,0,0,0,4,0x2c,0x76,0xff,0xff, 0x7f,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xc3,0xff,3,0,0x1f,0x50,0,0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xdf,0xbc,0x40,0xd7,0xff,0xff,0xfb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xbf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfb,0xfc, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xfe,0xff,0xff,0xff,0x7f,2,0xff,0xff,0xff,0xff,0xff,1,0xfe,0xff,0xff,0xff,0xff,0xbf,0xb6,0, 0xff,0xff,0xff,0x87,7,0,0,0,0xff,7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc3, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0x9f,0xff,0xfd,0xff,0x9f,0,0, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 3,0,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x24,0xff,0xff,0xff,0xff,0xff,0x3f,0,0,0xff,0xff, 0xff,0xf,0xff,7,0xff,0xff,0xff,0x7e,0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfb,0xff, 0xff,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xff,0x37,0xfe,0x21,0xff,0xff,0xcf,0xff,0xfe,0xff,0xe3,0x9f, 0xf9,0xff,0xff,0xfd,0xc5,0x33,0x1e,0x60,0,0xb0,0xcf,0xff,0xf3,0x53,0xe6,0x87,0xf9,0xff,0xff,0xfd, 0x6d,0x13,0x86,0x39,2,0x5e,0xc0,0xff,0x3f,0,0xe6,0xbf,0xfb,0xff,0xff,0xfd,0xed,0x33,0xbe,0x21, 1,0,0xcf,0xff,0,0xfe,0xe2,0x9f,0xf9,0xff,0xff,0xfd,0xed,0xb3,0x1e,0x20,0x60,0xb0,0xcf,0xff, 0xfe,0,0xec,0xc7,0x3d,0xd6,0x18,0xc7,0xff,3,1,0x20,1,0,0xc0,0xff,7,0,0xf1,0xdf, 0xfd,0xff,0xff,0xfd,0xff,0xf3,0xc1,0x3d,0x60,0x27,0xcf,0xff,0,0x7f,0xe3,0xdf,0xfd,0xff,0xff,0xfd, 0xef,0xb3,0x40,0x30,0,0x60,0xcf,0xff,6,0,0xf3,0xdf,0xfd,0xff,0xff,0xff,0xff,0x3f,0x1e,0x60, 0x70,0xff,0xcf,0xff,0xff,0xfd,0xe2,0xff,0x7f,0xfc,0xff,0xff,0xfb,0x2f,0x7f,4,0x5c,0,0xc0,0xff, 0,0,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,7,0xff,0x7f,0xff,3,0,0,0,0,0xd6,0xf7, 0xff,0xff,0xaf,0xff,0xff,0x3f,0x5f,0x7f,0xff,0xf3,0,0,0,0,1,0,0,3,0xff,0xff, 0xaf,2,0xff,0xfe,0xff,0xff,0xff,0x1f,0xfe,0x7f,0xdf,0xff,0xff,0xfe,0xff,0xff,0xff,0x1f,0x40,0, 0,0,0,0,0,0,0xff,0xff,0xff,0xff,0xff,0xe7,0xfd,0xe6,0xff,3,0x3f,0xff,0x63,0xc0, 0xff,0xff,0x67,0x60,0xff,0x23,0xff,0xff,0xff,0xff,0xbf,0x20,0xff,0xff,0xff,0xff,0xff,0xf7,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3d, 0x7f,0x3d,0xff,0xff,0xff,0xff,0xff,0x3d,0xff,0xff,0xff,0xff,0x3d,0x7f,0x3d,0xff,0x7f,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0x3d,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0,0xfe,0xff,0x1f,0xff,0xff, 0,0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0xfe,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9f,0xff,0xff,0xfe,0xff,0xff,7,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc7,0xff,1,0xff,0xff,0x1f,0x80,0xff,0xff,0xf,0,0xff,0xff, 0xf,0,0xff,0xdf,0xd,0,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0x3f,0x40,0xfe,0x8f,0x30,0xff,3, 0xff,3,0,0xb8,0xff,3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,1,0xff,0xff, 0xff,0xff,0xff,7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0,0xff,0xff,0xff,0x7f,0x87,1, 4,0xe,0xc0,0xff,0xff,0xff,0xff,0x3f,0x1f,0,0xff,0xff,0xff,0xff,0xff,0xf,0xff,0xff,0xff,3, 0xff,7,0,0,0,0,0xff,0xff,0xff,9,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0x7f,0xe5,0x1f, 0xf8,0x9f,0xff,3,0xff,3,0x80,0,0xff,0xbf,0xff,0x7f,0,0,0,0,0,0,0xef,0xff, 0xff,0xff,0xff,0xff,0xdf,0x17,0xe4,0x1f,0xff,3,0,0xf8,0xf,0,0xfb,0xff,0xff,0xff,0x3d,0xfb, 0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xa3,3,0,0xff,0xff,0xff,0xff,0xf,0xf0,0xcf,0,0xff,0xe3, 0xff,0xff,0xff,0xff,0xff,0x3f,0xff,1,0xff,0xff,0xff,0xff,0xff,0xe7,0,0,0xf7,0xff,0xfd,0xff, 0x7f,7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x3f,0xff,0xff,0xff,0xff,0x3f,0x3f,0xff,0xaa,0xff,0xff, 0xff,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xdf,0x5f,0xdc,0x1f,0xcf,0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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0x80,0,0,0,0,0,0,0,0,1, }; static int32_t bitmap_identifier_1_min_codepoint = 48; static int32_t bitmap_identifier_1_max_codepoint = 19968; static bool is_identifier_1_char(int32_t c) { int32_t offset = c - bitmap_identifier_1_min_codepoint; return (bitmap_identifier_1[offset >> 3] & (1u << (offset & 7))) > 0; } static uint8_t bitmap_identifier_2[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0x3f,0,0,0,0,0,0,0,0,0xfe,0xff,0xff,0xff,0xff,0x7f, 0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0xfe,0xff,0xff,0x1f,0,0, 0xfe,0xff,0xff,0xff,0xff,0xff,0xe1,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,7,0,0,0,0,0xff,0xf9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xf3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf,0xd6,7,0,0,0xf8,0xff,0xff,0xff,0xff,0xff, 0xcf,0x20,0x7e,0,0xfe,0xff,0xff,0xff,0xff,0xff,0x1f,0,0xf8,0xff,0xff,0xff,0xff,0xff,0x1f,0, 0x60,0,0xfe,7,0xfe,0xff,0xff,0xd1,0xff,0xff,0xff,0xff,0xff,0x7f,0xfe,0xff,0xff,0xff,7,0, 0xfe,0xff,0xff,0x3f,0xee,0xff,0xff,0xff,0xff,0xff,0x9f,0x67,0,0,0xff,7,0xfe,0xff,0xff,0xff, 0xfe,0xff,0xff,0xff,0xff,0xff,0xcc,0,0xfe,0x3f,0xfe,7,0xfe,0xff,0xff,0xa8,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xf,0,0,0x70,0xfe,0x6f,0xb8,0,0xfc,0xfc,0xfc,0,0xfe,0xfe,0xfe,0xff, 0xff,0xff,0xff,0xef,0xff,7,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0x4f,0x42,0xfe,7,2, }; static int32_t bitmap_identifier_2_min_codepoint = 40959; static int32_t bitmap_identifier_2_max_codepoint = 44032; static bool is_identifier_2_char(int32_t c) { int32_t offset = c - bitmap_identifier_2_min_codepoint; return (bitmap_identifier_2[offset >> 3] & (1u << (offset & 7))) > 0; } static uint8_t bitmap_identifier_3[] = { 1,0xe0,0xff,0xff,0xf,0xff,0xff,0xff,0xff,0xff,0xff,1,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0,0,0,0,0xe0,0xf,0,0x1f,0xfc,0xbf,0xff,0xef,0x6b, 0xfb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0,0,0,0,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,7,0,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9f,0xff,0xff,0xff,0xff,0xff,0xff, 0x1f,0,0,0,0,0xe0,0xff,0xe1,0xff,0x1f,0,0xe0,0xff,0x1f,0,0,0,0,0,0, 0,0xe0,0xfb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,3, 0,0xe0,0x7f,0xc0,0xff,0xff,0xff,0xc0,0xff,0xff,0xff,0,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0x8f,0x9f,0x9f,0x9f,3,0,0,0,0xe0,0xff,0xfd,0xff,0xff,0xef,0xff,0xff,0xf6, 0xff,0xe7,0xff,7,0,0,0,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0,0xf0,0xff,0xff,0xff,0xff,0xff,1,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0, 0x80,1,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0xe0,0xff,0xff,0xff,0xe3,0xff,0xff,0xff,0xff, 0xff,0x3f,0,0xe0,0xff,0xff,0xff,0xe1,0xff,0xff,0xff,0xff,1,0xfc,0xff,0xff,0xff,0xe0,0xff,0xff, 0xff,0xff,0xff,0xe0,0xff,0xff,0xff,0xe7,0xff,0xff,0xff,0xff,0xe1,0xdf,7,0,0,0,0,0xe0, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe7, 0x7f,0xe0,0xff,0xff,0xff,0xff,0xe1,0xff,0xff,0xff,0xff,0xe1,0xff,0xff,0xff,0xff,0x1f,0xe0,0xff,0xff, 0xff,0xff,0xff,0xff,1,0xe0,0xff,0xfe,0xff,0xfe,0xf6,0x7f,0xff,0x7f,0x7f,3,0,0,0,0, 0,0,0,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xf,0xe0,0xff,0xff,7,0xe0,0x1f,0,0,0xe0,0xf7,0xff,0xff,0xff,0xff,0xbf,0xff,0, 0,0,0,0,0,0,0,0xe0,0xa7,0xff,0xff,0xff,0xff,0xff,0x37,0xf2,0xff,0xff,0xe7,0xff, 0xff,0xff,0xcf,0xff,0xff,0xff,0xff,0xf,0xf0,0x1f,0,0,0,0,0,0xe0,0xff,0xff,6,0xff, 0xff,0xff,0xff,0xe1,0xff,0xff,0x7f,0,0,0,0,0,0,0,0,0xe0,0xff,0xff,0xff,0xff, 0xff,0xff,0x1f,0xfe,0xff,0x9f,0xff,0xff,0xff,0xff,0xff,0xff,0xd,0xfe,0xdd,0xff,0xff,0xff,0xe7,0xf0, 0x3f,0,0,0xe0,0xff,0xff,0xff,0xef,0xff,0xff,0xff,0x1f,0,0,0,0xe0,0xdf,0xff,0xff,0xff, 0xf,0x1f,0,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,7,0xe0,0xff,0xff,0xe7,0xff,0xff,0xff,0xe0,0xff, 0xff,0x7f,0,0,0xc0,0x1f,0,0,0,0,0,0,0,0,0,0xe0,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0x3f,0,0,0,0,0,0,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0,0xe0, 0xff,0xff,0xff,0xff,0xff,0xff,0x80,0xff,0xff,0xff,0xff,0xff,0x1f,0xe0,0x7f,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0xe0,0xff,0xff,0xff,0xef,0xff,0xff,0xff,0xff, 0x7f,0x63,0,0,0,0,0,0,0,0,0,0xfc,0xff,0xff,0xff,0xff,0x1f,0xe0,0xff,0xff, 0xff,0xff,3,0,0,0xe0,0xff,0xff,7,0,0,0,0,0xe0,0xff,0xff,0xff,1,0,0xe0, 0xff,0xff,0xf,0x40,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf,0x80,0xff,0xff,0xff,0xff,7,0x70, 0xff,0xff,0xff,0xff,0xff,0x1f,0xcf,0x80,0,0xe0,0xff,0xff,0x3f,0xe0,0x7f,0xe0,0xff,0xff,0xff,0xff, 0xff,0xfd,0xfb,0x1f,0x12,0xe0,0xff,0xff,0xff,0xff,9,0x60,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0xcf, 0xc3,0xf3,0xff,0xc2,0xff,0xff,3,0xe0,0xff,0x7f,0xff,0xff,0xff,0x71,0x1a,0x78,0,0,0,0, 0,0,0,0xe0,0xaf,0xf7,0xff,0xf7,0x3f,0xe0,0xff,0xff,0xff,0xff,0xff,0x1f,0xff,0xe0,0x7f,0x60, 0xfc,0x33,0xff,0xff,0xbf,0xbf,0x7d,0x27,0,0x20,0,0x7c,0xf8,0xe3,3,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xe3,0x9f, 0xfb,0xe0,0x7f,0x78,0,0,0,0xe0,0xff,0xff,0xff,0xff,0xff,0x1f,0xbf,0xb0,0x17,0xe0,0x7f,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xe0, 0xff,0xff,0xff,0xff,0xff,0x8f,7,0x36,0,0,0xe0,7,0,0,0,0xe0,0xff,0xff,0xff,0xff, 0xff,0x1f,0xff,0x34,2,0xe0,0x7f,0,0,0,0,0xe0,0xff,0xff,0xff,0xff,0xff,0xe5,0x37,0xe0, 0x7f,0,0,0,0,0,0,0xe0,0xff,0xff,0xff,0x9c,0xf7,0xe1,0xff,0xe1,0xf,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xe0, 0xff,0xff,0xff,0xff,0xff,0xf1,0xdf,0,0,0,0,0,0,0,0,0,0,0,0,0xe0, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0,0xf0,0x4f,0xfe,0xed,0xff,0xff,0x1f,0,0x5b, 1,0xe0,0x7f,0,0,0,0,0,0,0,0,0xe0,0x9f,0xff,0xff,0xff,0xff,0x3f,0x9e,0x61, 1,0,0,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0xf,0x10,0xe0,0xcf,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0x6f,4,0,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0xe0,0xbf,0xff,0xff,0xff,0xff,0xef,0xef,0x37,0,0xe0,0xff,0xff, 0xff,0x83,0xff,0xff,0xff,0x9f,0xff,0xff,0x9f,0xbf,0xd,0,0,0,0,0,0,0,0,0xe0, 0x6f,0xff,0xff,0xff,0xff,0xff,0x8f,0xf6,0x1f,0xe0,0x7f,0xe0,0xb7,0xff,0xff,0xff,0x7f,0x60,0x34,0xe0, 0x7f,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xe0, 0xff,0xff,3,0xe0,0xfe,0xbf,0xff,0xff,0xff,0xff,0xf9,0xa0,0,0xe0,0x7f,0,0,0,0,0, 0,0,0,0,0,0x20,0,0xe0,0xff,0xff,3,0,0,0,0,0xe0,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0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0xff, 0xff,0xff,0xff,0xff,0xff,0x3f,0,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0x1f,0,0xe0,0xff,0xff,7,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xe0, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0xe0,0xff,0xff,0xff,0xef,0x7f,0xe0,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0x7f,0xe0,0xff,0xff,0xff,0xe7,3,0xe0,0xff,0xff,0xff,0xff, 0xff,0xff,0xf,0xe0,1,0xe0,0x7f,0x7f,0xff,0xff,0x1f,0xfc,0xff,0x1f,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xe0, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf,0,0,0,0,0,0,0,0,0, 0,0,0,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x30,0,0,0,0,0,0, 0,0xf0,0xff,0x1f,0,0,0,0,0,0,0,0x60,3,0,0,0x20,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0x10,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,7,0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,0,0,0,0,0,0,0,0,0,0,0,0,0xe0,0x7f,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0x20, }; static int32_t bitmap_identifier_3_min_codepoint = 55203; static int32_t bitmap_identifier_3_max_codepoint = 131072; static bool is_identifier_3_char(int32_t c) { int32_t offset = c - bitmap_identifier_3_min_codepoint; return (bitmap_identifier_3[offset >> 3] & (1u << (offset & 7))) > 0; } static uint8_t bitmap_identifier_4[] = { 1,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, }; static int32_t bitmap_identifier_4_min_codepoint = 173791; static int32_t bitmap_identifier_4_max_codepoint = 205743; static bool is_identifier_4_char(int32_t c) { int32_t offset = c - bitmap_identifier_4_min_codepoint; return (bitmap_identifier_4[offset >> 3] & (1u << (offset & 7))) > 0; } static uint8_t bitmap_identifier_5[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, }; static int32_t bitmap_identifier_5_min_codepoint = 917760; static int32_t bitmap_identifier_5_max_codepoint = 917999; static bool is_identifier_5_char(int32_t c) { int32_t offset = c - bitmap_identifier_5_min_codepoint; return (bitmap_identifier_5[offset >> 3] & (1u << (offset & 7))) > 0; } static bool is_identifier_char(int32_t c) { return c < bitmap_identifier_1_min_codepoint ? false : c <= bitmap_identifier_1_max_codepoint ? is_identifier_1_char(c) : c < bitmap_identifier_2_min_codepoint ? false : c <= bitmap_identifier_2_max_codepoint ? is_identifier_2_char(c) : c < bitmap_identifier_3_min_codepoint ? false : c <= bitmap_identifier_3_max_codepoint ? is_identifier_3_char(c) : c < bitmap_identifier_4_min_codepoint ? false : c <= bitmap_identifier_4_max_codepoint ? is_identifier_4_char(c) : c < bitmap_identifier_5_min_codepoint ? false : c <= bitmap_identifier_5_max_codepoint ? is_identifier_5_char(c) : false; } static uint8_t bitmap_varid_start_1[] = { 0xff,0xff,0xff,3,0,0,0,0,0,2,0x10,2,0,0,0,0xc0,0xff,0xff,0xbf,0x7f, 0x55,0x55,0x55,0x55,0x55,0x55,0xd5,0xaa,0xaa,0x55,0x55,0x55,0x55,0x55,0x55,0xea,0x94,0x18,0x12,0x27, 0x95,0x96,0x28,0xf7,0x27,0xa9,0xaa,0x5a,0x55,0xd5,0x14,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xfd,0xc9, 0x42,0xd5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x45,0x1c, 0,0x80,0,0,0,0xf8,0xff,0xff,0xff,0xbf,0x71,0x55,0x55,0xd5,0x97,0xc,0,0,0,0, 0,0x80,0xff,0xff,0xff,0xff,0xff,0x7f,0x55,0x55,0x55,0x55,1,0x54,0x55,0x55,0x55,0x55,0x55,0x55, 0xaa,0x6a,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0,0,0,0,0,0x80, 0xff,0xff,0xff,0xff,0xff,0,0,0,0,0,0,0,0,0x80,0xff,0xff,0xff,0xc3,3,0, 0,0,0,0x80,0xff,0xff,0xff,0x7f,0xff,3,0,0,0,0x60,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0x17,0,0,0x60,0,0x4e,0,0x80,0xfe,0xff,0xff,0x7f,0,0, 0,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0,1,0,0,0xfe,0xff,0xff, 0xff,3,0,0x80,0xff,0xff,0x1f,0,0,0,0,0x80,0xff,0xff,0xff,0x80,0xff,0x83,0xff,0xff, 0x7f,0x3f,0,0x80,0xff,0xff,0xff,0xff,0xff,0,0,0,0,0,0,0,0xf8,0xff,0xff,0xff, 0xff,0xff,0xff,0x11,0,0x80,0x80,0xff,1,0,0xfe,0xff,0xf0,0xcf,0xfc,0xff,0xff,0xfe,0xe2,0x11, 0,0x20,0,0xd8,1,0x80,1,8,0xf0,0xc3,0xfc,0xff,0xff,0xfe,0xb6,1,0,0,0,0x2f, 0,0,0xe,0,0xf0,0xdf,0xfd,0xff,0xff,0xfe,0xf6,0x11,0,0x80,0,0x80,1,0,0,1, 0xf0,0xcf,0xfc,0xff,0xff,0xfe,0xf6,0x11,0,0,0,0xd8,1,0,1,0,0xf4,0xe3,0x1e,0x6b, 0x8c,0xe3,0xff,1,0,0x80,0,0,0,0,0,0,0xf0,0xef,0xfe,0xff,0xff,0xfe,0xff,0x11, 0,0,0x80,0x93,1,0,0,0x80,0xf0,0xef,0xfe,0xff,0xff,0xfe,0xf7,0x11,0,0,0,0xb0, 1,0,3,0,0xf8,0xef,0xfe,0xff,0xff,0xff,0xff,0x13,0,0x20,0x38,0xc0,1,0,0,0x7e, 0xf0,0xff,0x3f,0xfe,0xff,0xff,0xfd,0x97,0x3f,0,0,0,0,0,0,0,0xff,0xff,0xff,0xff, 0xff,0xff,6,0x80,0x1f,0,0,0,0,0,0,0,0xeb,0xfb,0xff,0xff,0xd7,0xff,6,0x90, 0xf,0,0,0x78,0,0,0,0x80,0,0,0,0,0,0,0,0x80,0x7f,0xff,0xff,0xff, 0xff,0xf,0,0,0x80,0xf,0,0,0,0,0,0,0,0,0,0,0,0,0,0x80, 0xff,0xff,0xff,0xff,0xff,3,0,0x40,0,0x80,0x1f,0x1e,0x31,0xe0,0xf0,0xff,1,0x20,0,0, 0,0,0,0,0,0x80,0xff,0xff,0xff,0xff,0xff,0xf3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0xbf,0x9e,0xff,0xff,0xff,0xff, 0xff,0x9e,0xff,0xff,0xff,0xff,0x9e,0xbf,0x9e,0xff,0xbf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9e,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,3,0,0,0,0x80,0xff,0x7f,0,0,0,0,0,0, 0,0,0,0,0,0,0x80,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xcf,0xff,0x7f,0xff,0xff,0xff,0x83,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,3,0xff,0x80,0xff,0xff,1,0xc0,0xff,0xff,1,0x80,0xff,0xff,1,0x80,0xff,0xef,0,0x80, 0xff,0xff,0xff,0xff,0xff,0xff,7,0,0,0,0,8,0,0,0,0,0,0,0,0x80, 0xff,0xff,0xff,0xff,0xfb,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0xcf,0xff,0xff,0xff,0xff,0x82,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0x80,0xff,0xff,0xff,0x3f,0,0,0,0,0,0x80,0xff,0xff, 0xff,0x9f,0xf,0x80,0xff,0xff,0xff,0xff,0xff,0x87,0xff,0xff,0xff,1,0,0,0,0,0,0x80, 0xff,0xff,0x3f,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xf,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0xf0,0xff,0xff,0xff,0xff,0xff,7,0, 0xf0,0xf,0,0,0,0,0,0,0xfc,0xff,0xff,0xff,0,0x60,0,0xfe,0xff,0xff,0xff,0xff, 0x1f,0,0,0x80,0xff,0xff,0xff,0xff,7,0,0,0,0,0x70,0,0xfe,0xff,0xff,0x7f,0x80, 0xff,0,0,0,0,0,0,0,0,0,0,0,0,0xef,0x37,0x82,0xff,0xff,0xff,0xff, 0xff,7,0,0,0,0,0,0,0,0xfc,0x7f,0xff,0xff,0xff,0xff,3,0,0,0,0, 0,0,0,0,0,0,0,0,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55, 0x55,0x55,0x55,0x55,0x55,0x55,0xf5,0x5f,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xd5, 0x7f,0x80,0x1f,0x80,0x7f,0x80,0x7f,0x80,0x1f,0x80,0x7f,0x80,0x7f,0x80,0xff,0x9f,0x7f,0x80,0x7f,0x80, 0x7f,0x80,0x6f,0x20,0x6e,0x80,0x67,0x80,0x7f,0,0x6e,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0x62,4,0,0,0x40,0xf8,0x19,0xe0,0x21,0,0,0,0,0,0, 8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0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,0,0,0,0,0x40,0,0,0,0, 0,0,0,0x80, }; static int32_t bitmap_varid_start_1_min_codepoint = 97; static int32_t bitmap_varid_start_1_max_codepoint = 19968; static bool is_varid_start_1_char(int32_t c) { int32_t offset = c - bitmap_varid_start_1_min_codepoint; return (bitmap_varid_start_1[offset >> 3] & (1u << (offset & 7))) > 0; } static uint8_t bitmap_varid_start_2[] = { 0xff,0xff,0xbf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0x3f,0,0,0,0,0,0,0,0,0xfe,0xff,0xff,0xff,0xff,1, 0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0xfe,0xff,1,0x18,0,0, 0x54,0x55,0x55,0x55,0x55,0xd5,0,0,0x54,0x55,0x55,0x15,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0x7f,0,0,0,0,0,0,0,0x50,0x55,0x57,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xfd,0x2b, 0x55,0xa1,0x75,0x55,0x55,5,0x41,0x55,0x15,0xa,0x54,5,0,0,0x80,0xf9,0x77,0xef,0xff,0xff, 0xf,0,0,0,0xfe,0xff,0xff,0xff,0xff,0xff,0x1f,0,0xf8,0xff,0xff,0xff,0xff,0xff,0x1f,0, 0,0,0,0,0,0,0xf8,0xd1,0,0xf8,0xff,0xff,0x7f,0,0xfe,0xff,0xff,0,0,0, 0xfe,0xff,0xff,0x3f,0xe0,0xff,0xff,0xff,0xff,0xff,0xf,0,0,0,0,0,0x3e,0xff,1,0xf8, 0xfe,0xff,0xff,0xff,0xff,3,0,0,0xee,0x1f,0,0,0xfe,0xff,0xfd,0x88,0xff,0xff,0xff,0xff, 0xff,0xff,0xc5,0x7c,0xa,0,0,0x30,0xfe,0xf,8,0,0xfc,0xfc,0xfc,0,0xfe,0xfe,0xfe,0xff, 0xff,0xff,0xff,0xf,0xfe,3,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xf,0,0,0,2, }; static int32_t bitmap_varid_start_2_min_codepoint = 40959; static int32_t bitmap_varid_start_2_max_codepoint = 44032; static bool is_varid_start_2_char(int32_t c) { int32_t offset = c - bitmap_varid_start_2_min_codepoint; return (bitmap_varid_start_2[offset >> 3] & (1u << (offset & 7))) > 0; } static uint8_t bitmap_varid_start_3[] = { 1,0xe0,0xff,0xff,0xf,0xff,0xff,0xff,0xff,0xff,0xff,1,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0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,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0,0,0,0,0xe0,0xf,0,0x1f,0xf4,0xbf,0xff,0xef,0x6b, 0xfb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0,0,0,0,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,7,0,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9f,0xff,0xff,0xff,0xff,0xff,0xff, 0x1f,0,0,0,0,0xe0,0xff,1,0,0,0,0,0,0,0,0,0,0,0,0, 0,0xe0,0xfb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,3, 0,0,0,0,0,0,0,0xc0,0xff,0xff,0xff,0,0xf8,0xdf,0xff,0xff,0xff,0xff,0xff,0xe7, 0xff,0xff,0xff,0x8f,0x9f,0x9f,0x9f,3,0,0,0,0xe0,0xff,0xfd,0xff,0xff,0xef,0xff,0xff,0xf6, 0xff,0xe7,0xff,7,0,0,0,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0xe0,0xff,0xff,0xff,0xe3,0xff,0xff,0xff,0xff, 0xff,0x3f,0,0,0,0,0,0xe0,0xff,0xff,0xff,0x1f,0,0xfc,0xff,0xbf,0x7f,0xe0,0xff,0xff, 0xff,0xff,7,0xe0,0xff,0xff,0xff,0xe7,0xff,0xff,0xff,0xff,0xe1,0x1f,0,0,0,0,0,0, 0,0,0,0,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,7, 0,0,0,0,0,0,0xe0,0xff,0xff,0xff,0xff,0xe1,0xff,0xff,0xff,0xff,0x1f,0xe0,0xff,0xff, 0xff,0xff,0xff,0xff,1,0,0,0,0,0,0xf0,0x7f,0xff,0x7f,0x7f,3,0,0,0,0, 0,0,0,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xf,0xe0,0xff,0xff,7,0xe0,0x1f,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0xe0,0xa7,0xff,0xff,0xff,0xff,0xff,0x37,0xf2,0xff,0xff,7,0xe0, 0xff,0xff,0xf,0xe0,0xff,0xff,0xff,0xf,0,0,0,0,0,0,0,0xe0,0xff,0xff,6,0xe0, 0xff,0xff,7,0xe0,0xff,0xff,0x7f,0,0,0,0,0,0,0,0,0xe0,0xff,0xff,0xff,0xff, 0xff,0xff,0x1f,0x18,0,0,0,0,0,0,0,0x20,0,0xe0,0xdd,0xff,0xff,0xff,7,0, 0,0,0,0xe0,0xff,0xff,0xff,0xe3,0xff,0xff,0xff,3,0,0,0,0xe0,0xdf,0xff,0xff,0xff, 3,0,0,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,7,0xe0,0xff,0xff,7,0xe0,0xff,0xff,0,0xe0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0xff, 0xff,0x1f,0,0,2,0,0,0,0,0,0,0xe0,0xff,0xff,0xff,0xff,0xff,0,0x20,0, 0,0,0,0,0,0,0,0xe0,0xff,0xff,0xff,0,0,0,0,0xe0,0xf,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xe0, 0xff,0xff,0xff,0xff,0xff,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0xe0,0xff,0xff,0xff,0x1f,0,0,0,0xf0,0x4f,0xfe,0xed,0xff,0xff,0x1f,0,0x50, 0,0,0,0,0,0,0,0,0,0,0,0xe0,0x9f,0xff,0xff,0xff,0xff,0x3f,0,0x40, 1,0,0,0x20,0,0xff,0xff,0xff,0xff,0xff,0x80,0,0,0x20,0,0xfe,0xff,0xff,0xff,0xff, 0x7f,0,0,4,0,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0xe0,0xbf,0xff,0xff,0xff,0xff,0xf,0,0x20,0,0,0,0, 0,0x80,0xff,0xff,0xff,0x1f,0,0,0,0,0,0,0,0,0,0,0,0,0,0xe0, 0x6f,0xff,0xff,0xff,0xff,0x3f,0,0,8,0,0,0xe0,0xb7,0xff,0xff,0xff,0x7f,0,0x20,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xe0, 0xff,0xff,0,0x80,0xfe,0xbf,0xff,0xff,0xff,0xff,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0x20,0,0,0,0,0,0,0,0,0,0xe0,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xe0, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0xe0,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0x3f,0,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0x1f,0,0xc0,0xf,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0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,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xe0, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0xe0,0xff,0xff,0xff,0xf,0,0xe0,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf,0,0xe0,0xff,0xff,0xff,7,0,0xe0,0xff,0xff,0xff,0xff, 0xff,0x1f,0,0,0,0,0,0,0xff,0xff,0x1f,0xfc,0xff,0x1f,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0xe0,0xff,0xff,0xff,0x1f,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x20,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x20,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0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0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0x10,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0x20, }; static int32_t bitmap_varid_start_3_min_codepoint = 55203; static int32_t bitmap_varid_start_3_max_codepoint = 131072; static bool is_varid_start_3_char(int32_t c) { int32_t offset = c - bitmap_varid_start_3_min_codepoint; return (bitmap_varid_start_3[offset >> 3] & (1u << (offset & 7))) > 0; } static uint8_t bitmap_varid_start_4[] = { 1,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, }; static int32_t bitmap_varid_start_4_min_codepoint = 173791; static int32_t bitmap_varid_start_4_max_codepoint = 205743; static bool is_varid_start_4_char(int32_t c) { int32_t offset = c - bitmap_varid_start_4_min_codepoint; return (bitmap_varid_start_4[offset >> 3] & (1u << (offset & 7))) > 0; } static bool is_varid_start_char(int32_t c) { return c < bitmap_varid_start_1_min_codepoint ? false : c <= bitmap_varid_start_1_max_codepoint ? is_varid_start_1_char(c) : c < bitmap_varid_start_2_min_codepoint ? false : c <= bitmap_varid_start_2_max_codepoint ? is_varid_start_2_char(c) : c < bitmap_varid_start_3_min_codepoint ? false : c <= bitmap_varid_start_3_max_codepoint ? is_varid_start_3_char(c) : c < bitmap_varid_start_4_min_codepoint ? false : c <= bitmap_varid_start_4_max_codepoint ? is_varid_start_4_char(c) : false; } static uint8_t bitmap_conid_start_1[] = { 0xff,0xff,0xff,3,0,0,0,0,0,0,0,0,0,0,0,0x80,0xff,0xff,0xbf,0x3f, 0,0,0,0x80,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0x2a,0x55,0x55,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0x15, 0x6b,0xe7,0xed,0xd8,0x6a,0x69,0xd7,8,0xd8,0x56,0x55,0xa5,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0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x80, 0xff,0xff,0xff,0xff,0xff,0x7f,0,0,0,0,0,0x80,0x4e,0xf5,0x12,0xe0,0xaa,0xaa,0xaa,0xaa, 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,2,0x14,2, }; static int32_t bitmap_conid_start_1_min_codepoint = 65; static int32_t bitmap_conid_start_1_max_codepoint = 11506; static bool is_conid_start_1_char(int32_t c) { int32_t offset = c - bitmap_conid_start_1_min_codepoint; return (bitmap_conid_start_1[offset >> 3] & (1u << (offset & 7))) > 0; } static uint8_t bitmap_conid_start_2[] = { 0x55,0x55,0x55,0x55,0x55,0x15,0,0,0x55,0x55,0x55,5,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0x54,0x55,0x54,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0,0x6a, 0x55,0x28,0x45,0x55,0x55,0x7d,0x5f,0x55,0xf5,2,0x41,1,0,0,0x20, }; static int32_t bitmap_conid_start_2_min_codepoint = 42560; static int32_t bitmap_conid_start_2_max_codepoint = 42997; static bool is_conid_start_2_char(int32_t c) { int32_t offset = c - bitmap_conid_start_2_min_codepoint; return (bitmap_conid_start_2[offset >> 3] & (1u << (offset & 7))) > 0; } static uint8_t bitmap_conid_start_3[] = { 0xff,0xff,0xff,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x80,0xff,0xff,0xff,0x7f, }; static int32_t bitmap_conid_start_3_min_codepoint = 65313; static int32_t bitmap_conid_start_3_max_codepoint = 71871; static bool is_conid_start_3_char(int32_t c) { int32_t offset = c - bitmap_conid_start_3_min_codepoint; return (bitmap_conid_start_3[offset >> 3] & (1u << (offset & 7))) > 0; } static uint8_t bitmap_conid_start_4[] = { 0xff,0xff,0xff,0xff, }; static int32_t bitmap_conid_start_4_min_codepoint = 93760; static int32_t bitmap_conid_start_4_max_codepoint = 93791; static bool is_conid_start_4_char(int32_t c) { int32_t offset = c - bitmap_conid_start_4_min_codepoint; return (bitmap_conid_start_4[offset >> 3] & (1u << (offset & 7))) > 0; } static uint8_t bitmap_conid_start_5[] = { 0xff,0xff,0xff,3,0,0,0xf0,0xff,0xff,0x3f,0,0,0,0xff,0xff,0xff,3,0,0,0xd0, 0x64,0xde,0x3f,0,0,0,0xff,0xff,0xff,3,0,0,0xb0,0xe7,0xdf,0x1f,0,0,0,0x7b, 0x5f,0xfc,1,0,0,0xf0,0xff,0xff,0x3f,0,0,0,0xff,0xff,0xff,3,0,0,0xf0,0xff, 0xff,0x3f,0,0,0,0xff,0xff,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0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0xff,0xff,0xff,0xff,3, }; static int32_t bitmap_conid_start_5_min_codepoint = 119808; static int32_t bitmap_conid_start_5_max_codepoint = 125217; static bool is_conid_start_5_char(int32_t c) { int32_t offset = c - bitmap_conid_start_5_min_codepoint; return (bitmap_conid_start_5[offset >> 3] & (1u << (offset & 7))) > 0; } static bool is_conid_start_char(int32_t c) { return c < bitmap_conid_start_1_min_codepoint ? false : c <= bitmap_conid_start_1_max_codepoint ? is_conid_start_1_char(c) : c < bitmap_conid_start_2_min_codepoint ? false : c <= bitmap_conid_start_2_max_codepoint ? is_conid_start_2_char(c) : c < bitmap_conid_start_3_min_codepoint ? false : c <= bitmap_conid_start_3_max_codepoint ? is_conid_start_3_char(c) : c < bitmap_conid_start_4_min_codepoint ? false : c <= bitmap_conid_start_4_max_codepoint ? is_conid_start_4_char(c) : c < bitmap_conid_start_5_min_codepoint ? false : c <= bitmap_conid_start_5_max_codepoint ? is_conid_start_5_char(c) : false; } static uint8_t bitmap_symop_1[] = { 0x7f,0x7e,0,0xfe,0,0,0,0xe8,0,0,0,0x28,0,0,0,0,0xff,0xe9,0xe9,0x40, 0,0,0x40,0,0,0,0x40,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0x1e,0,0xfe,0x7f,0xf0,0xd7,0xff,0x7f,0,0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0,0,0,0,0,0,0,0,0,0xd0,1,0x70,0,0x70,0,0x70,0,0x30, 0,0x80,0x7f,0x80,0x7f,0x80,0xff,0xfc,0xcf,0xff,0xff,0x3f,0,0,0,0xe,0,0xe,0,0x80, 0xff,0xff,0xff,0xff,0,0,0,0,0,0,0,0x80,0xbd,1,0xe8,0xe0,0x57,0x21,0,0x86, 0xf,0x5e,0,0,0,0,0,0,0,0x86,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xf8,0xff,0xff, 0xff,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0,0,0x80,0xff,3,0,0, 0,0,0,0,0,0,0,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,1,0,0x80, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0,0,0, 0,0,0xf8,0xff,0xff,0xff,0xff,0xff,0xcf,0xff,0xff,0xff,0x1f,0x80,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,3,0,0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xf8,0xff,0xff,0xff,0xe7, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xff,0xff,0xff,0xdf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0x7f,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0xf0,3,0,0x6f,0,0,0,0, 0,0,0,0,0,0,0,0,0,0x80,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0x80,0xe1,0xe4,0xff,0x67,0,0xbe,0xff,0xff,0xfd,0xff,0xf,0x10, 0,0,0,0x80,0xff,0xff,0xff,0xfd,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,7,0x80, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0,0,0x80,0xff,0x7f,0xf,0,6,0x88,0,0x80,0x60,0x70, 0,0,0,0,0,0,0,0,0,0,0,0x8c,0,0,0,0,0,0,0,0, 0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0x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_min_codepoint = 33; static int32_t bitmap_symop_1_max_codepoint = 19967; static bool is_symop_1_char(int32_t c) { int32_t offset = c - bitmap_symop_1_min_codepoint; return (bitmap_symop_1[offset >> 3] & (1u << (offset & 7))) > 0; } static uint8_t bitmap_symop_2[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0,0,0,0,0,0,0xc0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0xe0,0,0,0,0,0,0,0,0,0,0,0,0, 8,0x40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xfc,0,0xff,0xff, 0x7f,0,3,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xf,0xc0,3,0,0, 0,0,0,0,0xf0,0,0,0,0,0,0,0,0,0,0,0xc0,0,0,0,0, 0,0x17,0,0,0,0,0,0xc0,0,0,0,0,0,0x80,0,0,0,0,0,0, 0,0,0,0,0,0,0xfe,0x3f,0,0xc0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0xf0,0,0,0x80,3,0,0,0,0,0,0,0,0,0,0, 0,0xc0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0xc, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8, }; static int32_t bitmap_symop_2_min_codepoint = 42128; static int32_t bitmap_symop_2_max_codepoint = 44011; static bool is_symop_2_char(int32_t c) { int32_t offset = c - bitmap_symop_2_min_codepoint; return (bitmap_symop_2[offset >> 3] & (1u << (offset & 7))) > 0; } static uint8_t bitmap_symop_3[] = { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xfe,0xff,3, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0x80,0xff,0x7f,0,0,0,0,0,0,0,0,0,0,0, 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,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,3, }; static int32_t bitmap_symop_3_min_codepoint = 64297; static int32_t bitmap_symop_3_max_codepoint = 77810; static bool is_symop_3_char(int32_t c) { int32_t offset = c - bitmap_symop_3_min_codepoint; return (bitmap_symop_3[offset >> 3] & (1u << (offset & 7))) > 0; } static uint8_t bitmap_symop_4[] = { 3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x80,0,0,0, 0,0,0,0,0,0xfe,0xc3,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0x1e,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x10, }; static int32_t bitmap_symop_4_min_codepoint = 92782; static int32_t bitmap_symop_4_max_codepoint = 94178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xff,0xff,0xff,0xf0,0x1f,0x30,0, 0xf0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xf,0xff,0xff,0xf1,0xff,0xf1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0x87,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0xf0,0xff,0x10,0, 0xf0,0xff,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xf,0xf0,0x3f,0xf0,0xff,0xff,0xff,0xff,0xf,0xf0,0xff, 0xff,0xff,0x33,0,0,0,0,0,0,0,0,0,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0,0xf0,0xff,0xf3,0xff, 0xf1,0x1f,0xf0,0xff,0xff,0xff,0xff,0xff,0xfb,3,0xfc,0xff,0xf0,0x1f,0xf0,0x1f,0xf0,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, 0xff,0x7f, }; static int32_t bitmap_symop_5_min_codepoint = 113820; static int32_t bitmap_symop_5_max_codepoint = 129994; static bool is_symop_5_char(int32_t c) { int32_t offset = c - bitmap_symop_5_min_codepoint; return (bitmap_symop_5[offset >> 3] & (1u << (offset & 7))) > 0; } static bool is_symop_char(int32_t c) { return c < bitmap_symop_1_min_codepoint ? false : c <= bitmap_symop_1_max_codepoint ? is_symop_1_char(c) : c < bitmap_symop_2_min_codepoint ? false : c <= bitmap_symop_2_max_codepoint ? is_symop_2_char(c) : c < bitmap_symop_3_min_codepoint ? false : c <= bitmap_symop_3_max_codepoint ? is_symop_3_char(c) : c < bitmap_symop_4_min_codepoint ? false : c <= bitmap_symop_4_max_codepoint ? is_symop_4_char(c) : c < bitmap_symop_5_min_codepoint ? false : c <= bitmap_symop_5_max_codepoint ? is_symop_5_char(c) : false; } static uint8_t bitmap_space[] = { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,1, }; static int32_t bitmap_space_min_codepoint = 32; static int32_t bitmap_space_max_codepoint = 12288; static bool is_space_char(int32_t c) { if (c < bitmap_space_min_codepoint || c > bitmap_space_max_codepoint) return false; int32_t offset = c - bitmap_space_min_codepoint; return (bitmap_space[offset >> 3] & (1u << (offset & 7))) > 0; } ================================================ FILE: test/corpus/char.txt ================================================ ================================================================================ char: [a-zA-Z0-9_] ================================================================================ a = 'a' a = 'b' a = '0' a = '1' a = '_' a = 'A' a = 'B' a = ',' -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))))) ================================================================================ char: symbols ================================================================================ a = '!' a = '#' a = '$' a = '%' a = '&' a = '⋆' a = '+' a = '.' a = '/' a = '<' a = '=' a = '>' a = '?' a = '^' a = '|' a = '-' a = '~' a = ':' a = '"' -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))))) ================================================================================ char: special symbols ================================================================================ a = '(' a = ')' a = ';' a = '[' a = ']' a = '`' a = '{' a = '}' -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))))) ================================================================================ char: character escape ================================================================================ a = '\a' a = '\b' a = '\f' a = '\n' a = '\r' a = '\t' a = '\v' a = '\\' a = '\"' a = '\'' a = '\&' -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))))) ================================================================================ char: space ================================================================================ a = ' ' -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (literal (char)))))) ================================================================================ char: escape ascii ================================================================================ a = '\NUL' a = '\SOH' a = '\STX' a = '\ETX' a = '\EOT' a = '\ENQ' a = '\ACK' a = '\BEL' a = '\BS' a = '\HT' a = '\LF' a = '\VT' a = '\FF' a = '\CR' a = '\SO' a = '\SI' a = '\DLE' a = '\DC1' a = '\DC2' a = '\DC3' a = '\DC4' a = '\NAK' a = '\SYN' a = '\ETB' a = '\CAN' a = '\EM' a = '\SUB' a = '\ESC' a = '\FS' a = '\GS' a = '\RS' a = '\US' a = '\SP' a = '\DEL' -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))))) ================================================================================ char: Escape Control Characters ================================================================================ a = '\^A' a = '\^Z' a = '\^@' a = '\^[' a = '\^]' a = '\^\' a = '\^^' a = '\^_' -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))))) ================================================================================ char: non-ascii unicode ================================================================================ a = '‘' -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (literal (char)))))) ================================================================================ char: unicode whitespace ================================================================================ a = a a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (variable)))))) ================================================================================ char: magic hash ================================================================================ a = 'a'# a = 'a'## -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (literal (char)))) (bind (variable) (match (literal (char)))))) ================================================ FILE: test/corpus/class.txt ================================================ ================================================================================ class: minimal ================================================================================ class A a -------------------------------------------------------------------------------- (haskell declarations: (declarations (class name: (name) patterns: (type_params bind: (variable))))) ================================================================================ class: context variants ================================================================================ class A a => Read a class (A a, A a) => A a -------------------------------------------------------------------------------- (haskell (declarations (class (context (apply (name) (variable))) (name) (type_params (variable))) (class (context (tuple (apply (name) (variable)) (apply (name) (variable)))) (name) (type_params (variable))))) ================================================================================ class: method with context ================================================================================ class A a where a :: A a => a -> a -------------------------------------------------------------------------------- (haskell declarations: (declarations (class name: (name) patterns: (type_params bind: (variable)) declarations: (class_declarations declaration: (signature name: (variable) type: (context context: (apply constructor: (name) argument: (variable)) type: (function parameter: (variable) result: (variable)))))))) ================================================================================ class: braces ================================================================================ class Foo a where { a :: a; a :: a; } -------------------------------------------------------------------------------- (haskell (declarations (class (name) (type_params (variable)) (class_declarations (signature (variable) (variable)) (signature (variable) (variable)))))) ================================================================================ class: fixity ================================================================================ class A where infixl `op` a :: Int infixr 7 ++ a = a -------------------------------------------------------------------------------- (haskell (declarations (class (name) (class_declarations (fixity (infix_id (variable))) (signature (variable) (name)) (fixity (integer) (operator)) (bind (variable) (match (variable))))))) ================================================================================ class: binding list ================================================================================ class A where (<), a, (<=), (>=), a, (>) :: a -------------------------------------------------------------------------------- (haskell (declarations (class (name) (class_declarations (signature (binding_list (prefix_id (operator)) (variable) (prefix_id (operator)) (prefix_id (operator)) (variable) (prefix_id (operator))) (variable)))))) ================================================================================ class: multi param ================================================================================ class A a a a -------------------------------------------------------------------------------- (haskell (declarations (class (name) (type_params (variable) (variable) (variable))))) ================================================================================ class: default signature ================================================================================ class A where a :: Int default a :: Int -------------------------------------------------------------------------------- (haskell (declarations (class (name) (class_declarations (signature (variable) (name)) (default_signature (signature (variable) (name))))))) ================================================================================ class: type variable kind ================================================================================ class A (a :: [*] -> k) -------------------------------------------------------------------------------- (haskell (declarations (class (name) (type_params (parens (annotated (variable) (function (list (star)) (variable)))))))) ================================================================================ class: associated family ================================================================================ class A a where type A a :: a type A a = a | a -> a type A a = A type family A a :: a type family A a = a | a -> a -------------------------------------------------------------------------------- (haskell (declarations (class (name) (type_params (variable)) (class_declarations (type_family (name) (type_params (variable)) (variable)) (type_family (name) (type_params (variable)) (type_family_result (variable)) (type_family_injectivity (variable) (variable))) (type_instance (name) (type_patterns (variable)) (name)) (type_family (name) (type_params (variable)) (variable)) (type_family (name) (type_params (variable)) (type_family_result (variable)) (type_family_injectivity (variable) (variable))))))) ================================================================================ class: associated data ================================================================================ class A a where data A a data family A a :: * -> Type -------------------------------------------------------------------------------- (haskell (declarations (class (name) (type_params (variable)) (class_declarations (data_family (name) (type_params (variable))) (data_family (name) (type_params (variable)) (function (star) (name))))))) ================================================================================ class: fundeps ================================================================================ class A | a -> a a, a a -> a -------------------------------------------------------------------------------- (haskell declarations: (declarations (class name: (name) fundeps: (fundeps fundep: (fundep matched: (variable) determined: (variable) determined: (variable)) fundep: (fundep matched: (variable) matched: (variable) determined: (variable)))))) ================================================================================ class: infix operator name ================================================================================ class a ++ b -------------------------------------------------------------------------------- (haskell declarations: (declarations (class (infix bind: (variable) operator: (operator) bind: (variable))))) ================================================================================ class: infix constructor operator name ================================================================================ class a :++ b -------------------------------------------------------------------------------- (haskell declarations: (declarations (class (infix bind: (variable) operator: (constructor_operator) bind: (variable))))) ================================================================================ class: prefix operator name ================================================================================ class (++) a b -------------------------------------------------------------------------------- (haskell (declarations (class (prefix_id (operator)) (type_params (variable) (variable))))) ================================================================================ class: ticked name ================================================================================ class ((((a)) `A` a)) -------------------------------------------------------------------------------- (haskell (declarations (class (parens (parens (infix (parens (parens (variable))) (infix_id (name)) (variable))))))) ================================================================================ class: multiple type families unannotated ================================================================================ class A a where type A a type A a type A a = () a :: a -------------------------------------------------------------------------------- (haskell (declarations (class (name) (type_params (variable)) (class_declarations (type_family (name) (type_params (variable))) (type_family (name) (type_params (variable))) (type_instance (name) (type_patterns (variable)) (unit)) (signature (variable) (variable)))))) ================================================================================ class: where on new line ================================================================================ module A where class A where -------------------------------------------------------------------------------- (haskell (header (module (module_id))) (declarations (class (name)))) ================================================ FILE: test/corpus/comment.txt ================================================ ================================================================================ comment: line ================================================================================ -- -- a -- -- a -------------------------------------------------------------------------------- (haskell (comment)) ================================================================================ comment: multi ================================================================================ {- a a - a -} f = a {-a-} -------------------------------------------------------------------------------- (haskell (comment) (declarations (bind (variable) (match (variable))) (comment))) ================================================================================ comment: hash inside ================================================================================ {- #comment -} -------------------------------------------------------------------------------- (haskell (comment)) ================================================================================ comment: newline termination ================================================================================ -- -------------------------------------------------------------------------------- (haskell (comment)) ================================================================================ comment: nested ================================================================================ {- comment {- nested -} } a = -} a = a -------------------------------------------------------------------------------- (haskell (comment) (declarations (bind (variable) (match (variable))))) ================================================================================ comment: unicode symbol ================================================================================ -- ∀ {- ∀ -} -------------------------------------------------------------------------------- (haskell (comment) (comment)) ================================================================================ comment: repeated minus before multiline end ================================================================================ module A where {- --} {- a -----} -------------------------------------------------------------------------------- (haskell (header (module (module_id))) (comment) (comment)) ================================================================================ comment: double brace before nested begin ================================================================================ module A where {- {{- -} -} -------------------------------------------------------------------------------- (haskell (header (module (module_id))) (comment)) ================================================================================ comment: terminated by eof ================================================================================ a = a {- a aaa -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))) (comment))) ================================================================================ comment: end of line ================================================================================ a = a -- a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))) (comment))) ================================================================================ comment: escaped heralds ================================================================================ {- {\- -\} -} -------------------------------------------------------------------------------- (haskell (comment)) ================================================================================ comment: multiple braces ================================================================================ {- {{{{{ }}}}} -} -------------------------------------------------------------------------------- (haskell (comment)) ================================================================================ comment: symop char after first space ================================================================================ a = a -- > a a = a -- > a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))) (comment) (bind (variable) (match (variable))) (comment))) ================================================================================ comment: haddock ================================================================================ data A = A A -- ^ a A {- ^ a -} -- | a -- a a = a {- | a -} data A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (prefix (constructor) (name) (haddock) (name))))) (haddock) (haddock) (bind (variable) (match (variable))) (haddock) (data_type (name)))) ================================================ FILE: test/corpus/consym.txt ================================================ ================================================================================ consym: valid ================================================================================ data A = Int :+ Int -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (infix (name) (constructor_operator) (name))))))) ================================================================================ consym: error: :: ================================================================================ data A = Int :: Int -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (prefix (constructor) (ERROR) (name))))))) ================================================ FILE: test/corpus/context.txt ================================================ ================================================================================ context: smoke ================================================================================ a :: a -> a a ++ a a => a a a => (?aaa :: a -> a -> a) => (∀ a . A a => A a) => a -> a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (function (variable) (context (infix (apply (variable) (variable)) (operator) (apply (variable) (variable))) (context (apply (apply (variable) (variable)) (variable)) (context (parens (implicit_parameter (implicit_variable) (function (variable) (function (variable) (variable))))) (context (parens (forall (quantified_variables (variable)) (context (apply (name) (variable)) (apply (name) (variable))))) (function (variable) (variable)))))))))) ================================================================================ context: trivial ================================================================================ a :: a => a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (variable) (variable))))) ================================================================================ context: infix constraint simple ================================================================================ a :: a ++ a => a -------------------------------------------------------------------------------- (haskell declarations: (declarations (signature name: (variable) type: (context context: (infix left_operand: (variable) operator: (operator) right_operand: (variable)) type: (variable))))) ================================================================================ context: apply in left infix operand ================================================================================ a :: A a ++ a => a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (infix (apply (name) (variable)) (operator) (variable)) (variable))))) ================================================================================ context: apply in both infix operands ================================================================================ a :: a -> a a ++ a a => a a a => a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (function (variable) (context (infix (apply (variable) (variable)) (operator) (apply (variable) (variable))) (context (apply (apply (variable) (variable)) (variable)) (variable))))))) ================================================================================ context: quantified ================================================================================ a :: (∀ a . A a => A a) => a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (parens (forall (quantified_variables (variable)) (context (apply (name) (variable)) (apply (name) (variable))))) (variable))))) ================================================================================ context: apply constraint ================================================================================ type A = A a => A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (context (apply (name) (variable)) (name))))) ================================================================================ context: parens apply constraint ================================================================================ type A = (a A) a => A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (context (apply (parens (apply (variable) (name))) (variable)) (name))))) ================================================================================ context: type annotation ================================================================================ type A = (A :: A a -> A) a => A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (context (apply (parens (signature (name) (function (apply (name) (variable)) (name)))) (variable)) (name))))) ================================================================================ context: constraint, then forall, then infix constraint ================================================================================ type A = A a => ∀ a . a *+* a => A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (context (apply (name) (variable)) (forall (quantified_variables (variable)) (context (infix (variable) (operator) (variable)) (name))))))) ================================================================================ context: in fun arg ================================================================================ type A = (A => a a) -> A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (function (parens (context (name) (apply (variable) (variable)))) (name))))) ================================================================================ context: ctuple ================================================================================ a :: (A, A a) => a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (tuple (name) (apply (name) (variable))) (variable))))) ================================================================================ context: multi, multi line ================================================================================ a :: A a a => (A a, A a) => (A => a a) -> A a -> a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (apply (apply (name) (variable)) (variable)) (context (tuple (apply (name) (variable)) (apply (name) (variable))) (function (parens (context (name) (apply (variable) (variable)))) (function (apply (name) (variable)) (variable)))))))) ================================================================================ context: multi, single line ================================================================================ a :: A a a => (A a, A a) => a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (apply (apply (name) (variable)) (variable)) (context (tuple (apply (name) (variable)) (apply (name) (variable))) (variable)))))) ================================================================================ context: forall/context in constraint ================================================================================ a :: (forall a . A => A) => A -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (parens (forall (quantified_variables (variable)) (context (name) (name)))) (name))))) ================================================================================ context: multiple nested foralls/contexts in constraint ================================================================================ a :: (forall a . forall a . (forall a . A => A) => forall a . A => A) => A -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (parens (forall (quantified_variables (variable)) (forall (quantified_variables (variable)) (context (parens (forall (quantified_variables (variable)) (context (name) (name)))) (forall (quantified_variables (variable)) (context (name) (name))))))) (name))))) ================================================================================ context: double parenthesis ================================================================================ a :: ((A)) => A -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (parens (parens (name))) (name))))) ================================================================================ context: annotated constraint tuple ================================================================================ a :: ((a, a) :: (A, A)) => a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (parens (signature (tuple (variable) (variable)) (tuple (name) (name)))) (variable))))) ================================================================================ context: annotated quantified constraint ================================================================================ a :: ((∀ a . A a) :: (A, A)) => a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (parens (signature (parens (forall (quantified_variables (variable)) (apply (name) (variable)))) (tuple (name) (name)))) (variable))))) ================================================================================ context: parenthesized contexts ================================================================================ a :: (A a, a ++ a) => a a :: ((A a ++ A a)) => a a :: (A a => A) => a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (tuple (apply (name) (variable)) (infix (variable) (operator) (variable))) (variable))) (signature (variable) (context (parens (parens (infix (apply (name) (variable)) (operator) (apply (name) (variable))))) (variable))) (signature (variable) (context (parens (context (apply (name) (variable)) (name))) (variable))))) ================================================================================ context: double context, infix, apply right ================================================================================ a :: a ++ a a => a => a a :: a ++ a a a => a => a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (infix (variable) (operator) (apply (variable) (variable))) (context (variable) (variable)))) (signature (variable) (context (infix (variable) (operator) (apply (apply (variable) (variable)) (variable))) (context (variable) (variable)))))) ================================================================================ context: double context, infix, apply left ================================================================================ a :: a a ++ a => a => a a :: a a a ++ a => a => a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (infix (apply (variable) (variable)) (operator) (variable)) (context (variable) (variable)))) (signature (variable) (context (infix (apply (apply (variable) (variable)) (variable)) (operator) (variable)) (context (variable) (variable)))))) ================================================================================ context: double context, apply ================================================================================ a :: a a => a => a a :: a a a => a => a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (apply (variable) (variable)) (context (variable) (variable)))) (signature (variable) (context (apply (apply (variable) (variable)) (variable)) (context (variable) (variable)))))) ================================================================================ context: promoted varsym ================================================================================ -- It is illegal to promote a varsym but we can be lenient. a :: a a '++ a => a -------------------------------------------------------------------------------- (haskell (comment) (declarations (signature (variable) (context (infix (apply (variable) (variable)) (promoted (operator)) (variable)) (variable))))) ================================================================================ context: promoted consym ================================================================================ a :: a a ':++ a => a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (infix (apply (variable) (variable)) (promoted (constructor_operator)) (variable)) (variable))))) ================================================================================ context: splice ================================================================================ a :: $(a) => a a :: (A, $(a)) => a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (splice (parens (variable))) (variable))) (signature (variable) (context (tuple (name) (splice (parens (variable)))) (variable))))) ================================================================================ context: parens around class apply constructor ================================================================================ a :: (A) a => a a :: ((A)) a => a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (apply (parens (name)) (variable)) (variable))) (signature (variable) (context (apply (parens (parens (name))) (variable)) (variable))))) ================================================================================ context: type application ================================================================================ a :: A @A a @a => a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (apply (apply (apply (name) (kind_application (name))) (variable)) (kind_application (variable))) (variable))))) ================================================================================ context: comment before arrow ================================================================================ a :: A -- a => A -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (name) (comment) (name))))) ================================================================================ context: symbol ================================================================================ a :: A "a" => a a :: A "a\\\\" => a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (apply (name) (literal (string))) (variable))) (signature (variable) (context (apply (name) (literal (string))) (variable))))) ================================================================================ context: char ================================================================================ a :: A 'a' => a a :: A '\n' => a a :: A '\^[' => a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (apply (name) (literal (char))) (variable))) (signature (variable) (context (apply (name) (literal (char))) (variable))) (signature (variable) (context (apply (name) (literal (char))) (variable))))) ================================================================================ context: prime newline skip ================================================================================ -- lookahead for ' advances over the space to check for another ' delimiting a -- char, which interferes with the subsequent `newline_lookahead` skip instance (A' (A)) => A -------------------------------------------------------------------------------- (haskell (comment) (declarations (instance (context (parens (apply (name) (parens (name))))) (name)))) ================================================================================ context: prime char false positive ================================================================================ -- the first and third ' are parsed as chars. the second char gobbles up the -- paren a :: (a' 'a')'a' => A -------------------------------------------------------------------------------- (haskell (comment) (declarations (signature (variable) (context (apply (parens (apply (variable) (literal (char)))) (literal (char))) (name))))) ================================================================================ context: nonzero-indent lookahead rejection ================================================================================ -- A context is valid at `b`, and since lookahead only stops at column 0, the -- => on the next line is valid unless :: is a termination token. class A where a :: b a :: a => a -------------------------------------------------------------------------------- (haskell (comment) (declarations (class (name) (class_declarations (signature (variable) (variable)) (signature (variable) (context (variable) (variable))))))) ================================================================================ context: zero-indent brace context ================================================================================ -- In record braces, zero-indent does not guarantee a new layout element. data A = A {a :: a => a} -------------------------------------------------------------------------------- (haskell (comment) (declarations (data_type (name) (data_constructors (data_constructor (record (constructor) (fields (field (field_name (variable)) (context (variable) (variable)))))))))) ================================================================================ context: conflict between symop and context lookahead reset ================================================================================ a = a @'(:) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (type_application (promoted (prefix_id (constructor_operator))))))))) ================================================================================ context: after deriving via ================================================================================ deriving via A instance A => A -------------------------------------------------------------------------------- (haskell (declarations (deriving_instance (via (name)) (context (name)) (name)))) ================================================================================ context: left infix nesting ================================================================================ a :: (a + a) + a => a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (infix (parens (infix (variable) (operator) (variable))) (operator) (variable)) (variable))))) ================================================================================ context: tight infix tilde ================================================================================ a :: a~a => A -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (infix (variable) (operator) (variable)) (name))))) ================================================================================ context: annotated infix in tuple ================================================================================ a :: (a + a :: A, a + a :: A) => a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (tuple (signature (infix (variable) (operator) (variable)) (name)) (signature (infix (variable) (operator) (variable)) (name))) (variable))))) ================================================================================ context: infix in constraint context ================================================================================ a :: (a + a => a) => a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (parens (context (infix (variable) (operator) (variable)) (variable))) (variable))))) ================================================================================ context: empty ================================================================================ a :: () => a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (unit) (variable))))) ================================================ FILE: test/corpus/cpp.txt ================================================ ================================================================================ cpp: keep layout from first if branch ================================================================================ a = do do do a <- a #ifndef Aaaa a <- a #elif Aaa a <- a a a #else a <- a a a #endif a <- a a a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (exp (do (exp (do (bind (variable) (variable)))) (cpp) (bind (variable) (variable)) (cpp) (cpp) (bind (variable) (variable)) (exp (variable)))) (exp (variable))))))) ================================================================================ cpp: multiline ================================================================================ a = a #if a \ a \ a \ a a = a #endif -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))) (cpp) (bind (variable) (match (variable))) (cpp))) ================================================================================ cpp: newline after decl in layout with one-way if ================================================================================ instance A where a = a #if a = a #endif -------------------------------------------------------------------------------- (haskell (declarations (instance (name) (instance_declarations (bind (variable) (match (variable))) (cpp) (bind (variable) (match (variable))))) (cpp))) ================================================================================ cpp: incomplete #if/#else ================================================================================ #if a a = a #else a = a -------------------------------------------------------------------------------- (haskell (cpp) (declarations (bind (variable) (match (variable))) (cpp))) ================================================================================ cpp: mid-line #endif ================================================================================ #if a a = a #else data A #endif instance A #endif -------------------------------------------------------------------------------- (haskell (cpp) (declarations (bind (variable) (match (variable))) (cpp) (cpp))) ================================================================================ cpp: do-let in #if ================================================================================ a = do #if a let a = a #else #endif a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (cpp) (let (local_binds (bind (variable) (match (variable))))) (cpp) (cpp) (exp (variable))))))) ================================================================================ cpp: layout ended in #else first ================================================================================ -- This ensures that the scanner's newline lookahead skips the entire #else -- branch when determining the next layout element's indent. -- In this case, the #else contains a new decl, while the actual indent should -- be given by the do statement after the #endif. a = do a #if a a #else a = do a #endif a a = a -------------------------------------------------------------------------------- (haskell (comment) (declarations (bind (variable) (match (do (exp (variable)) (cpp) (exp (variable)) (cpp) (cpp) (exp (variable))))) (bind (variable) (match (variable))))) ================================================================================ cpp: lambdacase layout interrupted by #else ================================================================================ a = \case #if a a #else a #endif -> a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (lambda_case (cpp) (alternatives (alternative (variable) (cpp) (cpp) (match (variable))))))))) ================================================================================ cpp: #include as function body ================================================================================ -- From GHC. allThePrimOps :: [PrimOp] allThePrimOps = #include "primop-list.hs-incl" -------------------------------------------------------------------------------- (haskell (comment) (declarations (signature (variable) (list (name))) (top_splice (variable)) (ERROR) (cpp))) ================================================================================ cpp: nested #if ================================================================================ a = do #if a <- a #else #if #elif #else #if #endif a a = a #endif a <- a a a = a #endif a <- a a a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (cpp) (bind (variable) (variable)) (cpp) (cpp) (bind (variable) (variable)) (exp (variable))))) (bind (variable) (match (variable))))) ================================================================================ cpp: precedence over comments ================================================================================ {- #if 1 #else -} #endif -- This is wrong, but it's unlikely that it's possible to get it right. -------------------------------------------------------------------------------- (haskell (comment) (cpp) (comment)) ================================================================================ cpp: label after newline ================================================================================ a = a #a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (label)))))) ================================================================================ cpp: hash operator in brace layout ================================================================================ a = A { a = a # a } -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (record (constructor) (field_update (field_name (variable)) (infix (variable) (operator) (variable)))))))) ================================================================================ cpp: only spaces after herald ================================================================================ a = do a do a <- a # a a a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (exp (apply (variable) (do (bind (variable) (variable)) (cpp) (exp (variable))))) (exp (variable))))) (bind (variable) (match (variable))))) ================================================================================ cpp: endif with trailing C comments ================================================================================ #if a = a #else #endif /* a */ a = a -------------------------------------------------------------------------------- (haskell (cpp) (declarations (bind (variable) (match (variable))) (cpp) (cpp) (bind (variable) (match (variable))))) ================================================================================ cpp: endif at eof ================================================================================ a = a where #if a = a #else a = a #endif -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable)) (cpp) (local_binds (bind (variable) (match (variable))))) (cpp) (cpp))) ================================================================================ cpp: first line if ================================================================================ #if module A where #else module A where #endif a = a -------------------------------------------------------------------------------- (haskell (cpp) (header (module (module_id))) (cpp) (cpp) (declarations (bind (variable) (match (variable))))) ================================================================================ cpp: shebang ================================================================================ #!/usr/bin/env cabal a = a -------------------------------------------------------------------------------- (haskell (cpp) (declarations (bind (variable) (match (variable))))) ================================================================================ cpp: mid-line label after block comment ================================================================================ a = a {- -}#define -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (comment) (label)))))) ================================================================================ cpp: mid-line label after newline ================================================================================ a = a #define a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (label)))) (bind (variable) (match (variable))))) ================================================================================ cpp: after do keyword ================================================================================ a = do #if !a <- a #endif a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (cpp) (bind (strict (variable)) (variable)) (cpp) (exp (variable))))))) ================================================================================ cpp: newline continuation ================================================================================ #if \ 1 #endif -- this one has trailing whitespace, which is valid #if \ 1 #endif -------------------------------------------------------------------------------- (haskell (cpp) (cpp) (comment) (cpp) (cpp)) ================================================ FILE: test/corpus/data.txt ================================================ ================================================================================ data: empty ================================================================================ data A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name)))) ================================================================================ data: one nullary con ================================================================================ data A = A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (prefix (constructor))))))) ================================================================================ data: one unary con ================================================================================ data A = A A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (prefix (constructor) (name))))))) ================================================================================ data: strict ================================================================================ data A = A !A !(A A) -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (prefix (constructor) (strict_field (name)) (strict_field (parens (apply (name) (name)))))))))) ================================================================================ data: lazy ================================================================================ data A = A ~A data A = ~A :+ ~A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (prefix (constructor) (lazy_field (name)))))) (data_type (name) (data_constructors (data_constructor (infix (lazy_field (name)) (constructor_operator) (lazy_field (name)))))))) ================================================================================ data: tyvars ================================================================================ data A a a a = A a !a [a] -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (type_params (variable) (variable) (variable)) (data_constructors (data_constructor (prefix (constructor) (variable) (strict_field (variable)) (list (variable)))))))) ================================================================================ data: unpack strict ================================================================================ data A = A {-# unpack #-} !A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (prefix (constructor) (pragma) (strict_field (name)))))))) ================================================================================ data: record ================================================================================ data A a = A { a :: A, a, a :: A, a :: {-# unpack #-} !a, a :: !A } -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (type_params (variable)) (data_constructors (data_constructor (record (constructor) (fields (field (field_name (variable)) (name)) (field (field_name (variable)) (field_name (variable)) (name)) (field (field_name (variable)) (pragma) (strict_field (variable))) (field (field_name (variable)) (strict_field (name)))))))))) ================================================================================ data: record zero indent ================================================================================ data A = A { a :: A, a :: A, a :: A , a :: A } a = a -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (record (constructor) (fields (field (field_name (variable)) (name)) (field (field_name (variable)) (name)) (field (field_name (variable)) (name)) (field (field_name (variable)) (name))))))) (bind (variable) (match (variable))))) ================================================================================ data: multiple cons ================================================================================ data A = A | A A | A !A A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (prefix (constructor))) (data_constructor (prefix (constructor) (name))) (data_constructor (prefix (constructor) (strict_field (name)) (name))))))) ================================================================================ data: deriving basic ================================================================================ data A = A deriving A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (prefix (constructor)))) (deriving (name))))) ================================================================================ data: deriving empty ================================================================================ data A deriving A data A deriving A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (deriving (name))) (data_type (name) (deriving (name))))) ================================================================================ data: deriving multi, strategy ================================================================================ data A = A deriving (A, A) deriving stock (A) -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (prefix (constructor)))) (deriving (tuple (name) (name))) (deriving (deriving_strategy) (parens (name)))))) ================================================================================ data: deriving via ================================================================================ data A = A deriving (A) via (A A) data A = A deriving (A) via A A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (prefix (constructor)))) (deriving (parens (name)) (via (parens (apply (name) (name)))))) (data_type (name) (data_constructors (data_constructor (prefix (constructor)))) (deriving (parens (name)) (via (apply (name) (name))))))) ================================================================================ data: deriving on newline, multiple ================================================================================ data A = A deriving A deriving A data A = A deriving A deriving A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (prefix (constructor)))) (deriving (name)) (deriving (name))) (data_type (name) (data_constructors (data_constructor (prefix (constructor)))) (deriving (name)) (deriving (name))))) ================================================================================ data: deriving with forall/context ================================================================================ data A = A deriving (∀ a . A => A) -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (prefix (constructor)))) (deriving (parens (forall (quantified_variables (variable)) (context (name) (name)))))))) ================================================================================ data: deriving prefix op ================================================================================ data A = A deriving ((+) A) data A = A deriving ((+)) -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (prefix (constructor)))) (deriving (parens (apply (prefix_id (operator)) (name))))) (data_type (name) (data_constructors (data_constructor (prefix (constructor)))) (deriving (parens (prefix_id (operator))))))) ================================================================================ data: deriving with annotation ================================================================================ data A deriving (A :: A) -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (deriving (parens (signature (name) (name))))))) ================================================================================ data: deriving with all features ================================================================================ data A deriving (∀ a . A a :: Type -> Constraint) -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (deriving (parens (signature (forall (quantified_variables (variable)) (apply (name) (variable))) (function (name) (name)))))))) ================================================================================ data: deriving empty ================================================================================ data A deriving () -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (deriving (unit))))) ================================================================================ data: datatype context trivial ================================================================================ data A => A -------------------------------------------------------------------------------- (haskell (declarations (data_type (context (name)) (name)))) ================================================================================ data: datatype context apply ================================================================================ data A a (A a) => A = A -------------------------------------------------------------------------------- (haskell (declarations (data_type (context (apply (apply (name) (variable)) (parens (apply (name) (variable))))) (name) (data_constructors (data_constructor (prefix (constructor))))))) ================================================================================ data: datatype context tuple ================================================================================ data (A a, A a) => A = A -------------------------------------------------------------------------------- (haskell (declarations (data_type (context (tuple (apply (name) (variable)) (apply (name) (variable)))) (name) (data_constructors (data_constructor (prefix (constructor))))))) ================================================================================ data: datatype context infix basic ================================================================================ data a +++ b => a *** b -------------------------------------------------------------------------------- (haskell (declarations (data_type (context (infix (variable) (operator) (variable))) (infix (variable) (operator) (variable))))) ================================================================================ data: datatype context infix parens ================================================================================ data (a %% b) => A -------------------------------------------------------------------------------- (haskell declarations: (declarations (data_type context: (context context: (parens (infix left_operand: (variable) operator: (operator) right_operand: (variable)))) name: (name)))) ================================================================================ data: MagicHash ================================================================================ data A = A !A# -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (prefix (constructor) (strict_field (name)))))))) ================================================================================ data: forall ================================================================================ data A = forall a . A | ∀ a . A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (forall (quantified_variables (variable))) (prefix (constructor))) (data_constructor (forall (quantified_variables (variable))) (prefix (constructor))))))) ================================================================================ data: constructor context ================================================================================ data A = ∀ a . A a => A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (forall (quantified_variables (variable))) (context (apply (name) (variable))) (prefix (constructor))))))) ================================================================================ data: tyvar kind ================================================================================ data A (a :: * -> 'A) -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (type_params (parens (annotated (variable) (function (star) (promoted (constructor))))))))) ================================================================================ data: signature ================================================================================ data A :: (k -> '[ 'A]) -> * -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (function (parens (function (variable) (promoted (list (promoted (constructor)))))) (star))))) ================================================================================ data: type operator varsym ================================================================================ data a +++ b = a :+++ b -------------------------------------------------------------------------------- (haskell (declarations (data_type (infix (variable) (operator) (variable)) (data_constructors (data_constructor (infix (variable) (constructor_operator) (variable))))))) ================================================================================ data: type operator consym ================================================================================ data a :<- b = a :<- b -------------------------------------------------------------------------------- (haskell (declarations (data_type (infix (variable) (constructor_operator) (variable)) (data_constructors (data_constructor (infix (variable) (constructor_operator) (variable))))))) ================================================================================ data: type operator applied parenthesized consym 1 ================================================================================ data (a :+: a) a a = A -------------------------------------------------------------------------------- (haskell (declarations (data_type (parens (infix (variable) (constructor_operator) (variable))) (type_params (variable) (variable)) (data_constructors (data_constructor (prefix (constructor))))))) ================================================================================ data: type operator applied parenthesized consym 2 ================================================================================ data (((a)) :+: (a :: a)) a (a :: a) = A -------------------------------------------------------------------------------- (haskell (declarations (data_type (parens (infix (parens (parens (variable))) (constructor_operator) (parens (annotated (variable) (variable))))) (type_params (variable) (parens (annotated (variable) (variable)))) (data_constructors (data_constructor (prefix (constructor))))))) ================================================================================ data: type data ================================================================================ type data A = A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (prefix (constructor))))))) ================================================================================ data: empty record ================================================================================ data A = A {} -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (record (constructor) (fields))))))) ================================================================================ data: special type heads ================================================================================ data () = () data [] a = MkNil -------------------------------------------------------------------------------- (haskell (declarations (data_type (unit) (data_constructors (data_constructor (special (unit))))) (data_type (prefix_list) (type_params (variable)) (data_constructors (data_constructor (prefix (constructor))))))) ================================================================================ data: special constructors ================================================================================ data A = () data A = (a, a) data A# = (# #) data A# = (# a #) data A# = (# a, a #) data A = (# a | #) | (# | a #) data List a = [] | a : List a -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (special (unit))))) (data_type (name) (data_constructors (data_constructor (special (tuple (variable) (variable)))))) (data_type (name) (data_constructors (data_constructor (special (unboxed_unit))))) (data_type (name) (data_constructors (data_constructor (special (unboxed_tuple (variable)))))) (data_type (name) (data_constructors (data_constructor (special (unboxed_tuple (variable) (variable)))))) (data_type (name) (data_constructors (data_constructor (special (unboxed_sum (variable)))) (data_constructor (special (unboxed_sum (variable)))))) (data_type (name) (type_params (variable)) (data_constructors (data_constructor (special (empty_list))) (data_constructor (infix (variable) (constructor_operator) (apply (name) (variable)))))))) ================================================================================ data: lenient trailing comma in record ================================================================================ data A = A { a :: A, a :: A, } -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (record (constructor) (fields (field (field_name (variable)) (name)) (field (field_name (variable)) (name))))))))) ================================================================================ data: infix bang ================================================================================ data A = A { a :: A ! A } -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (record (constructor) (fields (field (field_name (variable)) (infix (name) (operator) (name)))))))))) ================================================================================ data: ticked constructor ================================================================================ data A = a `A` a -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (infix (variable) (infix_id (constructor)) (variable))))))) ================================================================================ data: ticked context ================================================================================ data A = a `A` a => A data A = a `A.A` a => A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (context (infix (variable) (infix_id (name)) (variable))) (prefix (constructor))))) (data_type (name) (data_constructors (data_constructor (context (infix (variable) (infix_id (qualified (module (module_id)) (name))) (variable))) (prefix (constructor))))))) ================================================================================ data: complicated field type ================================================================================ data A = A (∀ a a . A a => A a => A -> A -> a) -------------------------------------------------------------------------------- (haskell declarations: (declarations (data_type name: (name) constructors: (data_constructors constructor: (data_constructor constructor: (prefix name: (constructor) field: (parens type: (forall variables: (quantified_variables bind: (variable) bind: (variable)) type: (context context: (apply constructor: (name) argument: (variable)) type: (context context: (apply constructor: (name) argument: (variable)) type: (function parameter: (name) result: (function parameter: (name) result: (variable))))))))))))) ================================================================================ data: invisible binders ================================================================================ data A @a (a :: A) @_ @(a :: A) @(_ :: A) = A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (type_params (invisible (variable)) (parens (annotated (variable) (name))) (invisible (wildcard)) (invisible (parens (annotated (variable) (name)))) (invisible (parens (annotated (wildcard) (name))))) (data_constructors (data_constructor (prefix (constructor))))))) ================================================================================ data: parens in prefix head ================================================================================ data (A a) a = A -------------------------------------------------------------------------------- (haskell (declarations (data_type (parens (name) (type_params (variable))) (type_params (variable)) (data_constructors (data_constructor (prefix (constructor))))))) ================================================================================ data: constructor context infix parens ================================================================================ data A = (a %% b) => A -------------------------------------------------------------------------------- (haskell declarations: (declarations (data_type name: (name) constructors: (data_constructors constructor: (data_constructor context: (context context: (parens (infix left_operand: (variable) operator: (operator) right_operand: (variable)))) constructor: (prefix name: (constructor))))))) ================================================ FILE: test/corpus/decl.txt ================================================ ================================================================================ decl: two trivial successive functions ================================================================================ a = a a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))) (bind (variable) (match (variable))))) ================================================================================ decl: do and where ================================================================================ a = do a where a = a -------------------------------------------------------------------------------- (haskell declarations: (declarations (bind name: (variable) match: (match expression: (do statement: (exp (variable)))) binds: (local_binds decl: (bind name: (variable) match: (match expression: (variable))))))) ================================================================================ decl: empty where ================================================================================ a = a where -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))))) ================================================================================ decl: where ================================================================================ a = a where a = a a = a where a = a a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable)) (local_binds (bind (variable) (match (variable))))) (bind (variable) (match (variable)) (local_binds (bind (variable) (match (variable))) (bind (variable) (match (variable))))))) ================================================================================ decl: case and where ================================================================================ a = case a of A a -> a A -> a where a = 1 a = 2 -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (case (variable) (alternatives (alternative (apply (constructor) (variable)) (match (variable))) (alternative (constructor) (match (variable)))))) (local_binds (bind (variable) (match (literal (integer)))) (bind (variable) (match (literal (integer)))))))) ================================================================================ decl: do, let, where ================================================================================ a a = do a <- a let z = a a where a = pure a a = 1 -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (variable)) (match (do (bind (variable) (variable)) (let (local_binds (bind (variable) (match (variable))))) (exp (variable)))) (local_binds (bind (variable) (match (apply (variable) (variable)))) (bind (variable) (match (literal (integer)))))))) ================================================================================ decl: variable binding list ================================================================================ a, a, a :: A -------------------------------------------------------------------------------- (haskell (declarations (signature (binding_list (variable) (variable) (variable)) (name)))) ================================================================================ decl: operator binding list ================================================================================ (<), (<=), (>=), a, (>) :: a -------------------------------------------------------------------------------- (haskell (declarations (signature (binding_list (prefix_id (operator)) (prefix_id (operator)) (prefix_id (operator)) (variable) (prefix_id (operator))) (variable)))) ================================================================================ decl: primop ================================================================================ a# :: a a# = a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (variable)) (bind (variable) (match (variable))))) ================================================================================ decl: ticked infix pattern ================================================================================ a `a` a = a -------------------------------------------------------------------------------- (haskell (declarations (function (infix (variable) (infix_id (variable)) (variable)) (match (variable))))) ================================================================================ decl: comment association ================================================================================ a = a -- | a a = do a -- | This comment should be located right before the following decl, but it can -- get pulled into the do unless the scanner is careful not to include any -- whitespace in layout ends. a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))) (haddock) (bind (variable) (match (do (exp (variable))))) (haddock) (bind (variable) (match (variable))))) ================================================================================ decl: fixity ================================================================================ infixr 7 `op`, `ip`, `ap` infix <$> infixr 7 <$> infix 7 : infixl 7 :. infix 7 :<: infixl 1 - -------------------------------------------------------------------------------- (haskell (declarations (fixity (integer) (infix_id (variable)) (infix_id (variable)) (infix_id (variable))) (fixity (operator)) (fixity (integer) (operator)) (fixity (integer) (constructor_operator)) (fixity (integer) (constructor_operator)) (fixity (integer) (constructor_operator)) (fixity (integer) (operator)))) ================================================================================ decl: infix function with extra args ================================================================================ (a ++ a) a a = a -------------------------------------------------------------------------------- (haskell (declarations (function (function_head_parens (infix (variable) (operator) (variable))) (patterns (variable) (variable)) (match (variable))))) ================================================================================ decl: symop constructor pattern in infix varop decl ================================================================================ (a :+ a) ! a = a -------------------------------------------------------------------------------- (haskell (declarations (function (infix (parens (infix (variable) (constructor_operator) (variable))) (operator) (variable)) (match (variable))))) ================================================================================ decl: infix varop decl ================================================================================ a == a = a A a == A a = a == a -------------------------------------------------------------------------------- (haskell (declarations (function (infix (variable) (operator) (variable)) (match (variable))) (function (infix (apply (constructor) (variable)) (operator) (apply (constructor) (variable))) (match (infix (variable) (operator) (variable)))))) ================================================================================ decl: error: varop in operand of infix varop decl ================================================================================ a == a + a = a -------------------------------------------------------------------------------- (haskell (declarations (top_splice (infix (variable) (operator) (apply (infix (variable) (operator) (variable)) (ERROR) (variable)))))) ================================================================================ decl: tuple pattern binder ================================================================================ (a, a) = a -------------------------------------------------------------------------------- (haskell (declarations (bind (tuple (variable) (variable)) (match (variable))))) ================================================================================ decl: con application pattern binder ================================================================================ A a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (apply (constructor) (variable)) (match (variable))))) ================================================================================ decl: parens con application pattern binder ================================================================================ (A a) = a -------------------------------------------------------------------------------- (haskell declarations: (declarations (bind pattern: (parens pattern: (apply function: (constructor) argument: (variable))) match: (match expression: (variable))))) ================================================================================ decl: function head with parens ================================================================================ (((((f) a)) b c) d) e f = a -------------------------------------------------------------------------------- (haskell (declarations (function (function_head_parens (function_head_parens (function_head_parens (function_head_parens (function_head_parens (variable)) (patterns (variable)))) (patterns (variable) (variable))) (patterns (variable))) (patterns (variable) (variable)) (match (variable))))) ================================================================================ decl: implicit parameter in where ================================================================================ a = a where ?a = a -------------------------------------------------------------------------------- (haskell declarations: (declarations (bind name: (variable) match: (match expression: (variable)) binds: (local_binds decl: (bind implicit: (implicit_variable) match: (match expression: (variable))))))) ================================================================================ decl: implicit parameter in do-let ================================================================================ a = do let ?a = a a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (let (local_binds (bind (implicit_variable) (match (variable))))) (exp (variable))))))) ================================================================================ decl: function/bind ambiguity ================================================================================ a a a = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (variable) (variable)) (match (variable))))) ================================================================================ decl: special name ================================================================================ group :: a using :: a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (variable)) (signature (variable) (variable)))) ================================================================================ decl: local fixity ================================================================================ a = a where a + a = a infixr 7 + -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable)) (local_binds (function (infix (variable) (operator) (variable)) (match (variable))) (fixity (integer) (operator)))))) ================================================================================ decl: regression test for ambiguity bug ================================================================================ a = case a of a -> b c :: (a, d a) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (case (variable) (alternatives (alternative (variable) (match (variable))))))) (signature (variable) (tuple (variable) (apply (variable) (variable)))))) ================================================================================ decl: guards ================================================================================ a a | a , let a = a a = a , a <- a = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (variable)) (match (guards (boolean (variable)) (let (local_binds (bind (variable) (match (variable))) (bind (variable) (match (variable))))) (pattern_guard (variable) (variable))) (variable))))) ================================================ FILE: test/corpus/default.txt ================================================ ================================================================================ default: default decl ================================================================================ default () default (A, A :: A) -------------------------------------------------------------------------------- (haskell (declarations (default_types) (default_types (name) (signature (name) (name))))) ================================================ FILE: test/corpus/exp.txt ================================================ ================================================================================ exp: application ================================================================================ a = a a a = a a a a = a A.a a a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (variable)))) (bind (variable) (match (apply (apply (variable) (variable)) (variable)))) (bind (variable) (match (apply (apply (apply (variable) (qualified (module (module_id)) (variable))) (variable)) (variable)))))) ================================================================================ exp: con application ================================================================================ a = A a a a = A a A -------------------------------------------------------------------------------- (haskell declarations: (declarations (bind name: (variable) match: (match expression: (apply function: (apply function: (constructor) argument: (variable)) argument: (variable)))) (bind name: (variable) match: (match expression: (apply function: (apply function: (constructor) argument: (variable)) argument: (constructor)))))) ================================================================================ exp: unit ================================================================================ a = () -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (unit))))) ================================================================================ exp: comprehension ================================================================================ a = [(a, a) | a <- a, a <- [a..a]] a = [a | a, let a = a] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (list_comprehension (tuple (variable) (variable)) (qualifiers (generator (variable) (variable)) (generator (variable) (arithmetic_sequence (variable) (variable))))))) (bind (variable) (match (list_comprehension (variable) (qualifiers (boolean (variable)) (let (local_binds (bind (variable) (match (variable))))))))))) ================================================================================ exp: operator section right ================================================================================ a = (: a) a = (:< a) a = (A.:+ a) a = (`a` a) a = (`A.a` a) a = (+ a + a) a = (+ a + a + a) a = (A.+ a A.+ a) a = (A.+ a + a) a = (+ a A.+ a) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (right_section (constructor_operator) (variable)))) (bind (variable) (match (right_section (constructor_operator) (variable)))) (bind (variable) (match (right_section (qualified (module (module_id)) (constructor_operator)) (variable)))) (bind (variable) (match (right_section (infix_id (variable)) (variable)))) (bind (variable) (match (right_section (infix_id (qualified (module (module_id)) (variable))) (variable)))) (bind (variable) (match (right_section (operator) (infix (variable) (operator) (variable))))) (bind (variable) (match (right_section (operator) (infix (variable) (operator) (infix (variable) (operator) (variable)))))) (bind (variable) (match (right_section (qualified (module (module_id)) (operator)) (infix (variable) (qualified (module (module_id)) (operator)) (variable))))) (bind (variable) (match (right_section (qualified (module (module_id)) (operator)) (infix (variable) (operator) (variable))))) (bind (variable) (match (right_section (operator) (infix (variable) (qualified (module (module_id)) (operator)) (variable))))))) ================================================================================ exp: operator section left ================================================================================ a = (a :) a = (a :|) a = (a A.:|) a = (a $) a = (a a $) a = (a a A.$) a = (a `a`) a = (a `A.a`) a = (a + a +) a = (a + a + a + a +) a = (a A.+ a +) a = (a + a A.+) a = (a A.A.+ a A.A.+) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (left_section (variable) (constructor_operator)))) (bind (variable) (match (left_section (variable) (constructor_operator)))) (bind (variable) (match (left_section (variable) (qualified (module (module_id)) (constructor_operator))))) (bind (variable) (match (left_section (variable) (operator)))) (bind (variable) (match (left_section (apply (variable) (variable)) (operator)))) (bind (variable) (match (left_section (apply (variable) (variable)) (qualified (module (module_id)) (operator))))) (bind (variable) (match (left_section (variable) (infix_id (variable))))) (bind (variable) (match (left_section (variable) (infix_id (qualified (module (module_id)) (variable)))))) (bind (variable) (match (left_section (infix (variable) (operator) (variable)) (operator)))) (bind (variable) (match (left_section (infix (variable) (operator) (infix (variable) (operator) (infix (variable) (operator) (variable)))) (operator)))) (bind (variable) (match (left_section (infix (variable) (qualified (module (module_id)) (operator)) (variable)) (operator)))) (bind (variable) (match (left_section (infix (variable) (operator) (variable)) (qualified (module (module_id)) (operator))))) (bind (variable) (match (left_section (infix (variable) (qualified (module (module_id) (module_id)) (operator)) (variable)) (qualified (module (module_id) (module_id)) (operator))))))) ================================================================================ exp: left section with infix id ================================================================================ a = (a ` a ` ) a = (a `A ` ) a = (a ` A.A`) a = (a ` a ` ) a = (a ` Aaaa.Aaaa.A.a ` ) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (left_section (variable) (infix_id (variable))))) (bind (variable) (match (left_section (variable) (infix_id (constructor))))) (bind (variable) (match (left_section (variable) (infix_id (qualified (module (module_id)) (constructor)))))) (bind (variable) (match (left_section (variable) (infix_id (variable))))) (bind (variable) (match (left_section (variable) (infix_id (qualified (module (module_id) (module_id) (module_id)) (variable)))))))) ================================================================================ exp: left section operator after newline ================================================================================ a = (a #) a = (a -) a = (a A.A.++) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (left_section (variable) (operator)))) (bind (variable) (match (left_section (variable) (operator)))) (bind (variable) (match (left_section (variable) (qualified (module (module_id) (module_id)) (operator))))))) ================================================================================ exp: infix operator ================================================================================ a = A <$> a .: "a" <*> a a = do a <- a =<< a a <- a >>= a a = (a + a) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (constructor) (operator) (infix (variable) (operator) (infix (literal (string)) (operator) (variable)))))) (bind (variable) (match (do (bind (variable) (infix (variable) (operator) (variable))) (bind (variable) (infix (variable) (operator) (variable)))))) (bind (variable) (match (parens (infix (variable) (operator) (variable))))))) ================================================================================ exp: infix assoc ================================================================================ a = a + a + a a = a . a $ a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (variable) (operator) (infix (variable) (operator) (variable))))) (bind (variable) (match (infix (variable) (operator) (infix (variable) (operator) (variable))))))) ================================================================================ exp: infix con/var ================================================================================ a = a `a` a a = a `A.a` a a = a `A` a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (variable) (infix_id (variable)) (variable)))) (bind (variable) (match (infix (variable) (infix_id (qualified (module (module_id)) (variable))) (variable)))) (bind (variable) (match (infix (variable) (infix_id (constructor)) (variable)))))) ================================================================================ exp: error: infix TH-quoted consym ================================================================================ a = a ':++ a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (th_quoted_name (ERROR (UNEXPECTED '+')) (variable))))))) ================================================================================ exp: lambda simple ================================================================================ a = \ a -> a a = \ (A a) -> a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (lambda (patterns (variable)) (variable)))) (bind (variable) (match (lambda (patterns (parens (apply (constructor) (variable)))) (variable)))))) ================================================================================ exp: double lambda ================================================================================ a = \ a -> a >>= \ a -> a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (lambda (patterns (variable)) (infix (variable) (operator) (lambda (patterns (variable)) (variable)))))))) ================================================================================ exp: lambda and infix ================================================================================ a = \ a -> a : a : a a = \ a a a -> a <$> a <*> a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (lambda (patterns (variable)) (infix (variable) (constructor_operator) (infix (variable) (constructor_operator) (variable)))))) (bind (variable) (match (lambda (patterns (variable) (variable) (variable)) (infix (variable) (operator) (infix (variable) (operator) (variable)))))))) ================================================================================ exp: parenthesized infix ================================================================================ a = (a <$> a) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (parens (infix (variable) (operator) (variable))))))) ================================================================================ exp: apply in operand of qualified varop ================================================================================ a = a a A.+++ a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (apply (variable) (variable)) (qualified (module (module_id)) (operator)) (variable)))))) ================================================================================ exp: tuple section ================================================================================ a = (a,) a = (a,,) a = (,a,) a = (,,a) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (tuple (variable)))) (bind (variable) (match (tuple (variable)))) (bind (variable) (match (tuple (variable)))) (bind (variable) (match (tuple (variable)))))) ================================================================================ exp: conditional ================================================================================ a = if a then a else a a = if (if a then a else a) then a else a a = if if a then a else a then a else a -------------------------------------------------------------------------------- (haskell declarations: (declarations (bind name: (variable) match: (match expression: (conditional if: (variable) then: (variable) else: (variable)))) (bind name: (variable) match: (match expression: (conditional if: (parens expression: (conditional if: (variable) then: (variable) else: (variable))) then: (variable) else: (variable)))) (bind name: (variable) match: (match expression: (conditional if: (conditional if: (variable) then: (variable) else: (variable)) then: (variable) else: (variable)))))) ================================================================================ exp: implicit ================================================================================ a = aa (a ?cmp) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (parens (apply (variable) (implicit_variable)))))))) ================================================================================ exp: let basic ================================================================================ a = let a = a a = a in a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (let_in (local_binds (bind (variable) (match (variable))) (bind (variable) (match (variable)))) (variable)))))) ================================================================================ exp: lambda case simple ================================================================================ a = \case A a -> a a = a >>= \case A (A _ a) -> do a <- a a _ -> a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (lambda_case (alternatives (alternative (apply (constructor) (variable)) (match (variable))))))) (bind (variable) (match (infix (variable) (operator) (lambda_case (alternatives (alternative (apply (constructor) (parens (apply (apply (constructor) (wildcard)) (variable)))) (match (do (bind (variable) (variable)) (exp (variable))))) (alternative (wildcard) (match (variable)))))))))) ================================================================================ exp: lambda case and infix ================================================================================ a = \case a -> a : a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (lambda_case (alternatives (alternative (variable) (match (infix (variable) (constructor_operator) (variable)))))))))) ================================================================================ exp: n-ary cases ================================================================================ a = \cases A a a -> a a@(A a) a -> a -------------------------------------------------------------------------------- (haskell declarations: (declarations (bind name: (variable) match: (match expression: (lambda_cases alternatives: (alternatives alternative: (alternative patterns: (patterns (constructor) (variable) (variable)) match: (match expression: (variable))) alternative: (alternative patterns: (patterns (as bind: (variable) pattern: (parens pattern: (apply function: (constructor) argument: (variable)))) (variable)) match: (match expression: (variable))))))))) ================================================================================ exp: do and let ================================================================================ a a = do let z = a a <- a let z = a a <- a pure a -------------------------------------------------------------------------------- (haskell declarations: (declarations (function name: (variable) patterns: (patterns (variable)) match: (match expression: (do statement: (let binds: (local_binds decl: (bind name: (variable) match: (match expression: (variable))))) statement: (bind pattern: (variable) expression: (variable)) statement: (let binds: (local_binds decl: (bind name: (variable) match: (match expression: (variable))))) statement: (bind pattern: (variable) expression: (variable)) statement: (exp (apply function: (variable) argument: (variable)))))))) ================================================================================ exp: do statement with pattern lhs ================================================================================ a = do ((), a) <- a a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (bind (tuple (unit) (variable)) (variable)) (exp (variable))))))) ================================================================================ exp: qualified do ================================================================================ a = A.A.do a a = A.A.mdo a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (do_module (module (module_id) (module_id))) (exp (variable))))) (bind (variable) (match (do (do_module (module (module_id) (module_id))) (exp (variable))))))) ================================================================================ exp: i at eol (scanner tests for `in`) ================================================================================ a = a i -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (variable)))))) ================================================================================ exp: record construction with wildcard ================================================================================ a = A {.. } a = A { ..} a = A {..} a = A { .. } -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (record (constructor) (field_update (wildcard))))) (bind (variable) (match (record (constructor) (field_update (wildcard))))) (bind (variable) (match (record (constructor) (field_update (wildcard))))) (bind (variable) (match (record (constructor) (field_update (wildcard))))))) ================================================================================ exp: record update ================================================================================ a = a { a = a, a = a ++ a } a = A { a = a } {a = a} a = a a {a = a} a = a a a {a = a} -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (record (variable) (field_update (field_name (variable)) (variable)) (field_update (field_name (variable)) (infix (variable) (operator) (variable)))))) (bind (variable) (match (record (record (constructor) (field_update (field_name (variable)) (variable))) (field_update (field_name (variable)) (variable))))) (bind (variable) (match (apply (variable) (record (variable) (field_update (field_name (variable)) (variable)))))) (bind (variable) (match (apply (apply (variable) (variable)) (record (variable) (field_update (field_name (variable)) (variable)))))))) ================================================================================ exp: record field pun ================================================================================ a = A { A.a } -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (record (constructor) (field_update (qualified (module (module_id)) (field_name (variable))))))))) ================================================================================ exp: record zero indent update ================================================================================ a = do a { a = a , a = a } a a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (exp (apply (record (variable) (field_update (field_name (variable)) (variable)) (field_update (field_name (variable)) (variable))) (variable)))))) (bind (variable) (match (variable))))) ================================================================================ exp: record and minus ================================================================================ a = a {a} - a a a = a a {a} - a a a = a a a {a} - a a a = - a {a} a = - a a {a} a = - a a a {a} -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (record (variable) (field_update (field_name (variable)))) (operator) (apply (variable) (variable))))) (bind (variable) (match (infix (apply (variable) (record (variable) (field_update (field_name (variable))))) (operator) (apply (variable) (variable))))) (bind (variable) (match (infix (apply (apply (variable) (variable)) (record (variable) (field_update (field_name (variable))))) (operator) (apply (variable) (variable))))) (bind (variable) (match (negation (record (variable) (field_update (field_name (variable))))))) (bind (variable) (match (negation (apply (variable) (record (variable) (field_update (field_name (variable)))))))) (bind (variable) (match (negation (apply (apply (variable) (variable)) (record (variable) (field_update (field_name (variable)))))))))) ================================================================================ exp: type application ================================================================================ a = a @A a = a @a a a = a @A.A a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (type_application (name))))) (bind (variable) (match (apply (apply (variable) (type_application (variable))) (variable)))) (bind (variable) (match (apply (apply (variable) (type_application (qualified (module (module_id)) (name)))) (variable)))))) ================================================================================ exp: repeated type application ================================================================================ a = a @A @A @A @A -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (apply (apply (apply (variable) (type_application (name))) (type_application (name))) (type_application (name))) (type_application (name))))))) ================================================================================ exp: type application with promoted literal ================================================================================ a = a @'[] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (type_application (promoted (empty_list)))))))) ================================================================================ exp: block argument: lambda basic ================================================================================ a = a \ a -> a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (lambda (patterns (variable)) (variable))))))) ================================================================================ exp: block argument: lambda case ================================================================================ a = a \case a -> a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (lambda_case (alternatives (alternative (variable) (match (variable)))))))))) ================================================================================ exp: block argument: do ================================================================================ a = a do a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (do (exp (variable)))))))) ================================================================================ exp: block argument: let ================================================================================ a = a let a = a in a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (let_in (local_binds (bind (variable) (match (variable)))) (variable))))))) ================================================================================ exp: block argument: case ================================================================================ a = a case a of a -> a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (case (variable) (alternatives (alternative (variable) (match (variable)))))))))) ================================================================================ exp: greedy block argument: let ================================================================================ a = let a a = a in a do a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (let_in (local_binds (function (variable) (patterns (variable)) (match (variable)))) (apply (variable) (do (exp (variable))))))))) ================================================================================ exp: greedy block argument: lambda ================================================================================ a = a \ a -> a do a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (lambda (patterns (variable)) (apply (variable) (do (exp (variable)))))))))) ================================================================================ exp: greedy block argument: cond ================================================================================ a = a if a then a else a do a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (conditional (variable) (variable) (apply (variable) (do (exp (variable)))))))))) ================================================================================ exp: empty lambda case ================================================================================ a = \case a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (lambda_case))) (bind (variable) (match (variable))))) ================================================================================ exp: empty case ================================================================================ a = case a of a = (case a of) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (case (variable)))) (bind (variable) (match (parens (case (variable) (alternatives))))))) ================================================================================ exp: multi-way if ================================================================================ a = if | a -> a | a -> a a = if | a -> a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (multi_way_if (match (guards (boolean (variable))) (variable)) (match (guards (boolean (variable))) (variable))))) (bind (variable) (match (multi_way_if (match (guards (boolean (variable))) (variable))))))) ================================================================================ exp: multi-way if with two matches in a guard rhs ================================================================================ a | a = if | a -> a | a -> a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (guards (boolean (variable))) (multi_way_if (match (guards (boolean (variable))) (variable)) (match (guards (boolean (variable))) (variable))))))) ================================================================================ exp: list with multi-way if ================================================================================ a = [if | a, a <- a -> a | a -> a] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (list (multi_way_if (match (guards (boolean (variable)) (pattern_guard (variable) (variable))) (variable)) (match (guards (boolean (variable))) (variable)))))))) ================================================================================ exp: let with sig on rhs ================================================================================ a = let a = a in a :: A -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (let_in (local_binds (bind (variable) (match (variable)))) (signature (variable) (name))))))) ================================================================================ exp: list con ================================================================================ a = [] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (list))))) ================================================================================ exp: tuple con ================================================================================ a = (,,,) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (prefix_tuple))))) ================================================================================ exp: qualified symop ================================================================================ a = a A.!? a a = (A..!?) a = a A.. a a = a a a A.!? a a = a A.!? a a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))) (bind (variable) (match (prefix_id (qualified (module (module_id)) (operator))))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))) (bind (variable) (match (infix (apply (apply (variable) (variable)) (variable)) (qualified (module (module_id)) (operator)) (variable)))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (apply (variable) (variable))))))) ================================================================================ exp: th-promoted qualified symop ================================================================================ a = '(A..&) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (th_quoted_name (prefix_id (qualified (module (module_id)) (operator)))))))) ================================================================================ exp: negation in tuple ================================================================================ a = (-a, a) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (tuple (negation (variable)) (variable)))))) ================================================================================ exp: negation in section ================================================================================ a = (-a :) a = (- a a :) a = (+ -a) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (left_section (negation (variable)) (constructor_operator)))) (bind (variable) (match (left_section (negation (apply (variable) (variable))) (constructor_operator)))) (bind (variable) (match (right_section (operator) (negation (variable))))))) ================================================================================ exp: unboxed tuple ================================================================================ a :: (Int#, Int#) a :: (# Int, Int #) a = (# a, a #) -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (tuple (name) (name))) (signature (variable) (unboxed_tuple (name) (name))) (bind (variable) (match (unboxed_tuple (variable) (variable)))))) ================================================================================ exp: unboxed unit ================================================================================ a = (# #) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (unboxed_unit))))) ================================================================================ exp: unboxed solo ================================================================================ a = (# A a + a #) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (unboxed_tuple (infix (apply (constructor) (variable)) (operator) (variable))))))) ================================================================================ exp: section of unboxed tuple ================================================================================ a = (# ,,a, #) a = (# a,, #) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (unboxed_tuple (variable)))) (bind (variable) (match (unboxed_tuple (variable)))))) ================================================================================ exp: unboxed sum ================================================================================ a :: (# A | (# A, A #) | A #) a = (# a | | #) a = (#| a #) -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (unboxed_sum (name) (unboxed_tuple (name) (name)) (name))) (bind (variable) (match (unboxed_sum (variable)))) (bind (variable) (match (unboxed_sum (variable)))))) ================================================================================ exp: error: unboxed sum with missing space between bar and closing bracket ================================================================================ a = (# a |#) -------------------------------------------------------------------------------- (haskell (ERROR (variable) (variable) (operator))) ================================================================================ exp: label ================================================================================ a = a #a a a = (a)#a a = #øøø -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (apply (variable) (label)) (variable)))) (bind (variable) (match (apply (parens (variable)) (label)))) (bind (variable) (match (label))))) ================================================================================ exp: TransformListComp ================================================================================ a = [ a | then group by a :: A using a, then group by a using a, then group using a a, then a a by a a, then a :: A by a, then a a ] a = [a | using <- a] a = [group using a, group by a using a, by, a by, a by a, by a, using, a using, a using a, using a] -------------------------------------------------------------------------------- (haskell declarations: (declarations (bind name: (variable) match: (match expression: (list_comprehension expression: (variable) qualifiers: (qualifiers qualifier: (group key: (signature expression: (variable) type: (name)) classifier: (variable)) qualifier: (group key: (variable) classifier: (variable)) qualifier: (group classifier: (apply function: (variable) argument: (variable))) qualifier: (transform transformation: (apply function: (variable) argument: (variable)) key: (apply function: (variable) argument: (variable))) qualifier: (transform transformation: (signature expression: (variable) type: (name)) key: (variable)) qualifier: (transform transformation: (apply function: (variable) argument: (variable))))))) (bind name: (variable) match: (match expression: (list_comprehension expression: (variable) qualifiers: (qualifiers qualifier: (generator pattern: (variable) expression: (variable)))))) (bind name: (variable) match: (match expression: (list element: (apply function: (apply function: (variable) argument: (variable)) argument: (variable)) element: (apply function: (apply function: (apply function: (apply function: (variable) argument: (variable)) argument: (variable)) argument: (variable)) argument: (variable)) element: (variable) element: (apply function: (variable) argument: (variable)) element: (apply function: (apply function: (variable) argument: (variable)) argument: (variable)) element: (apply function: (variable) argument: (variable)) element: (variable) element: (apply function: (variable) argument: (variable)) element: (apply function: (apply function: (variable) argument: (variable)) argument: (variable)) element: (apply function: (variable) argument: (variable))))))) ================================================================================ exp: brace layout after lambda case ================================================================================ a = \case { a -> a } -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (lambda_case (alternatives (alternative (variable) (match (variable))))))))) ================================================================================ exp: unicode do bind arrow ================================================================================ a = do a ← a a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (bind (variable) (variable)) (exp (variable))))))) ================================================================================ exp: field projection with OverloadedRecordDot ================================================================================ a = a.a a = (a + a).a a = a.a.a.a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (projection (variable) (field_name (variable))))) (bind (variable) (match (projection (parens (infix (variable) (operator) (variable))) (field_name (variable))))) (bind (variable) (match (projection (projection (projection (variable) (field_name (variable))) (field_name (variable))) (field_name (variable))))))) ================================================================================ exp: projection in infix ================================================================================ a = a ++ a.a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (variable) (operator) (projection (variable) (field_name (variable)))))))) ================================================================================ exp: projection with special name ================================================================================ a = a.group a.using -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (projection (variable) (field_name (variable))) (projection (variable) (field_name (variable)))))))) ================================================================================ exp: field selector from projection ================================================================================ a = (.a) a a = (.a).a.a a = ( .a) a = ( .a) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (projection_selector (variable)) (variable)))) (bind (variable) (match (projection (projection (projection_selector (variable)) (field_name (variable))) (field_name (variable))))) (bind (variable) (match (projection_selector (variable)))) (bind (variable) (match (projection_selector (variable)))))) ================================================================================ exp: OverloadedRecordUpdate ================================================================================ a = a {a.a.a = a} -------------------------------------------------------------------------------- (haskell declarations: (declarations (bind name: (variable) match: (match expression: (record expression: (variable) field: (field_update field: (field_path field: (field_name (variable)) subfield: (field_name (variable)) subfield: (field_name (variable))) expression: (variable))))))) ================================================================================ exp: lambda with $ in list ================================================================================ a = [a $ \a -> a] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (list (infix (variable) (operator) (lambda (patterns (variable)) (variable)))))))) ================================================================================ exp: annotation on list element ================================================================================ a = [a :: A, a :: A] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (list (signature (variable) (name)) (signature (variable) (name))))))) ================================================================================ exp: greedy block arg in arithmetic sequence ================================================================================ a = [a \ a -> a .. a :: A] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (arithmetic_sequence (apply (variable) (lambda (patterns (variable)) (variable))) (signature (variable) (name))))))) ================================================================================ exp: annotation on tuple element ================================================================================ a = (a :: A, a :: A) a = (# a :: A, a :: A #) a = (# | | a :: A | #) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (tuple (signature (variable) (name)) (signature (variable) (name))))) (bind (variable) (match (unboxed_tuple (signature (variable) (name)) (signature (variable) (name))))) (bind (variable) (match (unboxed_sum (signature (variable) (name))))))) ================================================================================ exp: lenient trailing comma in list ================================================================================ a = [ a, A, ] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (list (variable) (constructor)))))) ================================================================================ exp: dollar infix with applications in operands ================================================================================ a = a a $ a a a a = a a $$ a a a a = a a $$$ a a = a a a $$$$ a a a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (apply (variable) (variable)) (operator) (apply (apply (variable) (variable)) (variable))))) (bind (variable) (match (infix (apply (variable) (variable)) (operator) (apply (apply (variable) (variable)) (variable))))) (bind (variable) (match (infix (apply (variable) (variable)) (operator) (variable)))) (bind (variable) (match (infix (apply (apply (variable) (variable)) (variable)) (operator) (apply (apply (variable) (variable)) (variable))))))) ================================================================================ exp: pattern guard annotation ================================================================================ a | a <- a :: a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (guards (pattern_guard (variable) (signature (variable) (variable)))) (variable))))) ================================================================================ exp: ParallelListComp ================================================================================ a = [a | a <- a | a <- a, let a = a | a <- a] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (list_comprehension (variable) (qualifiers (generator (variable) (variable))) (qualifiers (generator (variable) (variable)) (let (local_binds (bind (variable) (match (variable)))))) (qualifiers (generator (variable) (variable)))))))) ================================================================================ exp: case with multiple alternatives and matches ================================================================================ a = case a of a | a, a <- a, let a = a -> a | a -> a a | let a = a, a <- a, a -> a | a -> a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (case (variable) (alternatives (alternative (variable) (match (guards (boolean (variable)) (pattern_guard (variable) (variable)) (let (local_binds (bind (variable) (match (variable)))))) (variable)) (match (guards (boolean (variable))) (variable))) (alternative (variable) (match (guards (let (local_binds (bind (variable) (match (variable))))) (pattern_guard (variable) (variable)) (boolean (variable))) (variable)) (match (guards (boolean (variable))) (variable))))))))) ================================================================================ exp: identifier named then# ================================================================================ -- If the hash is not included in the predicate for non-id characters, the -- scanner would close the do layout before the `then#`, mistaking it for a -- `then`. a = if do a then# then a else a -------------------------------------------------------------------------------- (haskell (comment) (declarations (bind (variable) (match (conditional (do (exp (apply (variable) (variable)))) (variable) (variable)))))) ================================================================================ exp: explicit namespace for required type arguments ================================================================================ a = a (type a) (type A) (type (A a)) (A a) (type [∀ a . A a => A]) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (apply (apply (apply (apply (variable) (explicit_type (variable))) (explicit_type (name))) (explicit_type (parens (apply (name) (variable))))) (parens (apply (constructor) (variable)))) (explicit_type (list (forall (quantified_variables (variable)) (context (apply (name) (variable)) (name)))))))))) ================================================================================ exp: inline case with constructor after of ================================================================================ a = case a of A a -> a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (case (variable) (alternatives (alternative (apply (constructor) (variable)) (match (variable))))))))) ================================================================================ exp: qualified constructor in apply argument ================================================================================ a = a A.A -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (qualified (module (module_id)) (constructor))))))) ================================================================================ exp: type application before infix operator ================================================================================ a = a @a + a a = a @a a + a a = a @a `a` a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (apply (variable) (type_application (variable))) (operator) (variable)))) (bind (variable) (match (infix (apply (apply (variable) (type_application (variable))) (variable)) (operator) (variable)))) (bind (variable) (match (infix (apply (variable) (type_application (variable))) (infix_id (variable)) (variable)))))) ================================================================================ exp: th-quoted type before infix operator ================================================================================ a = a ''A + a a = a ''A `a` a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (apply (variable) (th_quoted_name (name))) (operator) (variable)))) (bind (variable) (match (infix (apply (variable) (th_quoted_name (name))) (infix_id (variable)) (variable)))))) ================================================================================ exp: lambda after varid with prime followed by n with prime ================================================================================ a = a'\n' -> a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (lambda (patterns (variable)) (variable))))))) ================================================ FILE: test/corpus/family.txt ================================================ ================================================================================ family: closed, nullary ================================================================================ type family A where A = A -------------------------------------------------------------------------------- (haskell (declarations (type_family (name) (equations (equation (name) (name)))))) ================================================================================ family: closed, tyvars ================================================================================ type family A a b c where A a 'A c = b c -------------------------------------------------------------------------------- (haskell declarations: (declarations (type_family name: (name) patterns: (type_params bind: (variable) bind: (variable) bind: (variable)) closed_family: (equations equation: (equation name: (name) patterns: (type_patterns (variable) (promoted (constructor)) (variable)) (apply constructor: (variable) argument: (variable))))))) ================================================================================ family: closed, pattern matching ================================================================================ type family A a b c where A (Maybe a) [c] = a (Maybe c) -------------------------------------------------------------------------------- (haskell (declarations (type_family (name) (type_params (variable) (variable) (variable)) (equations (equation (name) (type_patterns (parens (apply (name) (variable))) (list (variable))) (apply (variable) (parens (apply (name) (variable))))))))) ================================================================================ family: closed, signature ================================================================================ type family A a :: (k -> *) -> 'Just k where A a = a -------------------------------------------------------------------------------- (haskell declarations: (declarations (type_family name: (name) patterns: (type_params bind: (variable)) kind: (function parameter: (parens type: (function parameter: (variable) result: (star))) result: (apply constructor: (promoted (constructor)) argument: (variable))) closed_family: (equations equation: (equation name: (name) patterns: (type_patterns (variable)) (variable)))))) ================================================================================ family: closed, variable kind ================================================================================ type family A (a :: ([k] -> *) -> k) where A a = a -------------------------------------------------------------------------------- (haskell (declarations (type_family (name) (type_params (parens (annotated (variable) (function (parens (function (list (variable)) (star))) (variable))))) (equations (equation (name) (type_patterns (variable)) (variable)))))) ================================================================================ family: closed, multiple equations ================================================================================ type family A a where A a = a A a = a A a = a -------------------------------------------------------------------------------- (haskell declarations: (declarations (type_family name: (name) patterns: (type_params bind: (variable)) closed_family: (equations equation: (equation name: (name) patterns: (type_patterns (variable)) (variable)) equation: (equation name: (name) patterns: (type_patterns (variable)) (variable)) equation: (equation name: (name) patterns: (type_patterns (variable)) (variable)))))) ================================================================================ family: open ================================================================================ type family A (a :: a) :: * type instance A [A] = A type instance A (A A) = A -------------------------------------------------------------------------------- (haskell (declarations (type_family (name) (type_params (parens (annotated (variable) (variable)))) (star)) (type_instance (name) (type_patterns (list (name))) (name)) (type_instance (name) (type_patterns (parens (apply (name) (name)))) (name)))) ================================================================================ family: data family ================================================================================ data family A a (a :: [a]) :: Type -> * -------------------------------------------------------------------------------- (haskell (declarations (data_family (name) (type_params (variable) (parens (annotated (variable) (list (variable))))) (function (name) (star))))) ================================================================================ family: data instance adt ================================================================================ data instance ∀ a . A a A = A a A a | A { a :: A } -------------------------------------------------------------------------------- (haskell (declarations (data_instance (data_type (forall (quantified_variables (variable))) (name) (type_patterns (variable) (name)) (data_constructors (data_constructor (prefix (constructor) (variable) (name) (variable))) (data_constructor (record (constructor) (fields (field (field_name (variable)) (name)))))))))) ================================================================================ family: data instance gadt ================================================================================ data instance A a where A :: A -> A a deriving (A, A) -------------------------------------------------------------------------------- (haskell (declarations (data_instance (data_type (name) (type_patterns (variable)) (gadt_constructors (gadt_constructor (constructor) (prefix (function (name) (apply (name) (variable)))))) (deriving (tuple (name) (name))))))) ================================================================================ family: data instance newtype simple ================================================================================ newtype instance A a A = A a deriving A -------------------------------------------------------------------------------- (haskell (declarations (data_instance (newtype (name) (type_patterns (variable) (name)) (newtype_constructor (constructor) (field (variable))) (deriving (name)))))) ================================================================================ family: data instance newtype gadt ================================================================================ newtype instance A A where A :: A %1 -> A A newtype instance ∀ a . A a => A (a :: a) :: A where A :: A %1 -> A [a] deriving A -------------------------------------------------------------------------------- (haskell (declarations (data_instance (newtype (name) (type_patterns (name)) (gadt_constructors (gadt_constructor (constructor) (prefix (linear_function (name) (modifier (literal (integer))) (apply (name) (name)))))))) (data_instance (newtype (forall (quantified_variables (variable))) (context (apply (name) (variable))) (name) (type_patterns (parens (signature (variable) (variable)))) (name) (gadt_constructors (gadt_constructor (constructor) (prefix (linear_function (name) (modifier (literal (integer))) (apply (name) (list (variable))))))) (deriving (name)))))) ================================================================================ family: data instance newtype record ================================================================================ newtype instance A = A { a :: A } -------------------------------------------------------------------------------- (haskell (declarations (data_instance (newtype (name) (newtype_constructor (constructor) (record (field (field_name (variable)) (name)))))))) ================================================================================ family: injectivity annotation ================================================================================ module A where type family A a = r type family A a = (r :: A) | r -> a where A a = a -------------------------------------------------------------------------------- (haskell (header (module (module_id))) (declarations (type_family (name) (type_params (variable)) (type_family_result (variable))) (type_family (name) (type_params (variable)) (type_family_result (parens (signature (variable) (name)))) (type_family_injectivity (variable) (variable)) (equations (equation (name) (type_patterns (variable)) (variable)))))) ================================================================================ family: infix basic ================================================================================ type family a <> a where a <> a = a type instance A <> A = a -------------------------------------------------------------------------------- (haskell (declarations (type_family (infix (variable) (operator) (variable)) (equations (equation (infix (variable) (operator) (variable)) (variable)))) (type_instance (infix (name) (operator) (name)) (variable)))) ================================================================================ family: infix pattern mistaken as infix head ================================================================================ -- Many nodes to ensure the conflict is decided in favor of apply without prec type family A a a a a a where a <> a = a -------------------------------------------------------------------------------- (haskell (comment) (declarations (type_family (name) (type_params (variable) (variable) (variable) (variable) (variable)) (equations (equation (infix (variable) (operator) (variable)) (variable)))))) ================================================================================ family: kind signature in pattern ================================================================================ type family A where A (a :: A, a) = a -------------------------------------------------------------------------------- (haskell (declarations (type_family (name) (equations (equation (name) (type_patterns (tuple (signature (variable) (name)) (variable))) (variable)))))) ================================================================================ family: kind application ================================================================================ type family A where A @A @a @(A a) @(∀ a . A a :: A a) a = a type instance A @a A = a -------------------------------------------------------------------------------- (haskell (declarations (type_family (name) (equations (equation (name) (type_patterns (kind_application (name)) (kind_application (variable)) (kind_application (parens (apply (name) (variable)))) (kind_application (parens (signature (forall (quantified_variables (variable)) (apply (name) (variable))) (apply (name) (variable))))) (variable)) (variable)))) (type_instance (name) (type_patterns (kind_application (variable)) (name)) (variable)))) ================================================================================ family: symbolic prefix ================================================================================ type family (<>) where (<>) = A -------------------------------------------------------------------------------- (haskell (declarations (type_family (prefix_id (operator)) (equations (equation (prefix_id (operator)) (name)))))) ================================================================================ family: forall before equation ================================================================================ type family A a where ∀ a . A a = a type instance ∀ a . A a = a -------------------------------------------------------------------------------- (haskell (declarations (type_family (name) (type_params (variable)) (equations (equation (forall (quantified_variables (variable))) (name) (type_patterns (variable)) (variable)))) (type_instance (forall (quantified_variables (variable))) (name) (type_patterns (variable)) (variable)))) ================================================================================ family: abstract closed family, hs-boot ================================================================================ type family A where .. -------------------------------------------------------------------------------- (haskell (declarations (type_family (name) (abstract_family)))) ================================================================================ family: arrow in pattern ================================================================================ type family A where A (a -> a) = a -------------------------------------------------------------------------------- (haskell (declarations (type_family (name) (equations (equation (name) (type_patterns (parens (function (variable) (variable)))) (variable)))))) ================================================================================ family: infix asterisk ================================================================================ type family a * a -------------------------------------------------------------------------------- (haskell (declarations (type_family (infix (variable) (operator) (variable))))) ================================================================================ family: closed qualified ================================================================================ type family A where A.A.A a = a a A.A.++ a = a -------------------------------------------------------------------------------- (haskell (declarations (type_family (name) (equations (equation (qualified (module (module_id) (module_id)) (name)) (type_patterns (variable)) (variable)) (equation (infix (variable) (qualified (module (module_id) (module_id)) (operator)) (variable)) (variable)))))) ================================================================================ family: open qualified ================================================================================ type instance A.A.A a = a type instance a A.A.++ a = a -------------------------------------------------------------------------------- (haskell (declarations (type_instance (qualified (module (module_id) (module_id)) (name)) (type_patterns (variable)) (variable)) (type_instance (infix (variable) (qualified (module (module_id) (module_id)) (operator)) (variable)) (variable)))) ================================================ FILE: test/corpus/foreign.txt ================================================ ================================================================================ foreign: decl ================================================================================ foreign import prim safe "fun" a :: (# A#, A# #) foreign import capi unsafe "fun" a :: A foreign import ccall interruptible "fun" a :: A foreign import ccall "fun" a :: A foreign export stdcall "fun" a :: A foreign export javascript "fun" a :: A -------------------------------------------------------------------------------- (haskell (declarations (foreign_import (calling_convention) (safety) (entity (string)) (signature (variable) (unboxed_tuple (name) (name)))) (foreign_import (calling_convention) (safety) (entity (string)) (signature (variable) (name))) (foreign_import (calling_convention) (safety) (entity (string)) (signature (variable) (name))) (foreign_import (calling_convention) (entity (string)) (signature (variable) (name))) (foreign_export (calling_convention) (entity (string)) (signature (variable) (name))) (foreign_export (calling_convention) (entity (string)) (signature (variable) (name))))) ================================================ FILE: test/corpus/gadt.txt ================================================ ================================================================================ gadt: empty ================================================================================ data A where -------------------------------------------------------------------------------- (haskell (declarations (data_type (name)))) ================================================================================ gadt: basic ================================================================================ data A a where A :: A -> !(A a) -> A a A :: {-# unpack #-} A -> A a -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (type_params (variable)) (gadt_constructors (gadt_constructor (constructor) (prefix (function (name) (function (strict_field (parens (apply (name) (variable)))) (apply (name) (variable)))))) (gadt_constructor (constructor) (pragma) (prefix (function (name) (apply (name) (variable))))))))) ================================================================================ gadt: record ================================================================================ data A where A :: { a :: A, a :: !A } -> A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (gadt_constructors (gadt_constructor (constructor) (record (fields (field (field_name (variable)) (name)) (field (field_name (variable)) (strict_field (name)))) (name))))))) ================================================================================ gadt: signature ================================================================================ data A :: [*] -> * where -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (function (list (star)) (star))))) ================================================================================ gadt: context ================================================================================ data A a => A where -------------------------------------------------------------------------------- (haskell (declarations (data_type (context (apply (name) (variable))) (name)))) ================================================================================ gadt: con context ================================================================================ data A where A :: A a => A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (gadt_constructors (gadt_constructor (constructor) (context (apply (name) (variable))) (prefix (name))))))) ================================================================================ gadt: forall ================================================================================ data A where A :: ∀ a . A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (gadt_constructors (gadt_constructor (constructor) (forall (quantified_variables (variable))) (prefix (name))))))) ================================================================================ gadt: simple deriving ================================================================================ data A where A :: A deriving A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (gadt_constructors (gadt_constructor (constructor) (prefix (name)))) (deriving (name))))) ================================================================================ gadt: deriving ================================================================================ data A where A :: A deriving stock A deriving A via (A A) data A where A :: A deriving A deriving stock A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (gadt_constructors (gadt_constructor (constructor) (prefix (name)))) (deriving (deriving_strategy) (name)) (deriving (name) (via (parens (apply (name) (name)))))) (data_type (name) (gadt_constructors (gadt_constructor (constructor) (prefix (name)))) (deriving (name)) (deriving (deriving_strategy) (name))))) ================================================================================ gadt: symbolic operator ================================================================================ data a +++ b where (:+++) :: a -> b -> a +++ b -------------------------------------------------------------------------------- (haskell (declarations (data_type (infix (variable) (operator) (variable)) (gadt_constructors (gadt_constructor (prefix_id (constructor_operator)) (prefix (function (variable) (function (variable) (infix (variable) (operator) (variable)))))))))) ================================================================================ gadt: newtype ================================================================================ newtype A where A :: A -------------------------------------------------------------------------------- (haskell (declarations (newtype (name) (gadt_constructors (gadt_constructor (constructor) (prefix (name))))))) ================================================================================ gadt: symbolic type ================================================================================ data (:#) a where -------------------------------------------------------------------------------- (haskell (declarations (data_type (prefix_id (constructor_operator)) (type_params (variable))))) ================================================================================ gadt: strict/lazy ================================================================================ data A where A :: ~A -> A A :: !A -> A A :: A ~ A => A -> A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (gadt_constructors (gadt_constructor (constructor) (prefix (function (lazy_field (name)) (name)))) (gadt_constructor (constructor) (prefix (function (strict_field (name)) (name)))) (gadt_constructor (constructor) (context (infix (name) (operator) (name))) (prefix (function (name) (name)))))))) ================================================================================ gadt: type data ================================================================================ type data A a where A :: A ~ A => A a -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (type_params (variable)) (gadt_constructors (gadt_constructor (constructor) (context (infix (name) (operator) (name))) (prefix (apply (name) (variable)))))))) ================================================================================ gadt: multiplicity arrow ================================================================================ data A a where A :: a %1 -> A a -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (type_params (variable)) (gadt_constructors (gadt_constructor (constructor) (prefix (linear_function (variable) (modifier (literal (integer))) (apply (name) (variable))))))))) ================================================================================ gadt: con list ================================================================================ data A where A, A, A :: a -> A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (gadt_constructors (gadt_constructor (binding_list (constructor) (constructor) (constructor)) (prefix (function (variable) (name)))))))) ================================================================================ gadt: record with context ================================================================================ data A where A :: ∀ a . A => { a :: A } -> A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (gadt_constructors (gadt_constructor (constructor) (forall (quantified_variables (variable))) (context (name)) (record (fields (field (field_name (variable)) (name))) (name))))))) ================================================ FILE: test/corpus/id.txt ================================================ ================================================================================ id: variable ================================================================================ a = a _a0 = a _A0 = a a0 = a a9 = a aA = a aZ' = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))) (bind (variable) (match (variable))) (bind (variable) (match (variable))) (bind (variable) (match (variable))) (bind (variable) (match (variable))) (bind (variable) (match (variable))) (bind (variable) (match (variable))))) ================================================================================ id: constructor ================================================================================ data B = A | A0 | A9 | Aa | A_ | Az' -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (prefix (constructor))) (data_constructor (prefix (constructor))) (data_constructor (prefix (constructor))) (data_constructor (prefix (constructor))) (data_constructor (prefix (constructor))) (data_constructor (prefix (constructor))))))) ================================================================================ id: unicode ================================================================================ accenté = () data T = Œufs | Étonnement | Njtitlecasetest -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (unit))) (data_type (name) (data_constructors (data_constructor (prefix (constructor))) (data_constructor (prefix (constructor))) (data_constructor (prefix (constructor))))))) ================================================================================ id: hashes ================================================================================ a#### = a## data A## = A### -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))) (data_type (name) (data_constructors (data_constructor (prefix (constructor))))))) ================================================ FILE: test/corpus/implicit.txt ================================================ ================================================================================ implicit: synonym plain ================================================================================ type A = ?a :: A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (implicit_parameter (implicit_variable) (name))))) ================================================================================ implicit: synonym parens ================================================================================ type A = (?a :: A) -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (parens (implicit_parameter (implicit_variable) (name)))))) ================================================================================ implicit: synonym parens kind annotation ================================================================================ type A = (?a :: Int :: Constraint) -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (parens (signature (implicit_parameter (implicit_variable) (name)) (name)))))) ================================================================================ implicit: synonym parens constrained ================================================================================ type A = (A => ?a :: A) -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (parens (context (name) (implicit_parameter (implicit_variable) (name))))))) ================================================================================ implicit: synonym parens constrained ================================================================================ type A = (?a :: A.A, A) -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (tuple (implicit_parameter (implicit_variable) (qualified (module (module_id)) (name))) (name))))) ================================================================================ implicit: synonym tuple ================================================================================ type A = (?a :: A.A, A) -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (tuple (implicit_parameter (implicit_variable) (qualified (module (module_id)) (name))) (name))))) ================================================================================ implicit: synonym context ================================================================================ type A = (?a :: A) => A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (context (parens (implicit_parameter (implicit_variable) (name))) (name))))) ================================================================================ implicit: synonym forall/context in annotation ================================================================================ type A = ?a :: ∀ a . A a => A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (implicit_parameter (implicit_variable) (forall (quantified_variables (variable)) (context (apply (name) (variable)) (name))))))) ================================================================================ implicit: signature with function in annotation ================================================================================ a :: (?aaa :: a -> a -> a) => a -> a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (parens (implicit_parameter (implicit_variable) (function (variable) (function (variable) (variable))))) (function (variable) (variable)))))) ================================================ FILE: test/corpus/import.txt ================================================ ================================================================================ import: unqualified module plain ================================================================================ module A where import A a = a -------------------------------------------------------------------------------- (haskell (header (module (module_id))) (imports (import (module (module_id)))) (declarations (bind (variable) (match (variable))))) ================================================================================ import: unqualified module with empty export list ================================================================================ import A () -------------------------------------------------------------------------------- (haskell (imports (import (module (module_id)) (import_list)))) ================================================================================ import: unqualified module with alias ================================================================================ import A as A -------------------------------------------------------------------------------- (haskell (imports (import (module (module_id)) (module (module_id))))) ================================================================================ import: qualified module ================================================================================ import A.A -------------------------------------------------------------------------------- (haskell (imports (import (module (module_id) (module_id))))) ================================================================================ import: var only ================================================================================ import Aaa.A (aa) -------------------------------------------------------------------------------- (haskell (imports (import (module (module_id) (module_id)) (import_list (import_name (variable)))))) ================================================================================ import: type only ================================================================================ import Aaa.A (A) -------------------------------------------------------------------------------- (haskell (imports (import (module (module_id) (module_id)) (import_list (import_name (name)))))) ================================================================================ import: type with constructor ================================================================================ import Aaa.A (A(A)) -------------------------------------------------------------------------------- (haskell (imports (import (module (module_id) (module_id)) (import_list (import_name (name) (children (constructor))))))) ================================================================================ import: type with var ================================================================================ import Aaa.A (A(aa)) -------------------------------------------------------------------------------- (haskell (imports (import (module (module_id) (module_id)) (import_list (import_name (name) (children (variable))))))) ================================================================================ import: type with symbolic var ================================================================================ import Aaa.A (A((<>))) -------------------------------------------------------------------------------- (haskell (imports (import (module (module_id) (module_id)) (import_list (import_name (name) (children (prefix_id (operator)))))))) ================================================================================ import: type dotdot ================================================================================ import Aaa.A (A(..)) -------------------------------------------------------------------------------- (haskell (imports (import (module (module_id) (module_id)) (import_list (import_name (name) (children (all_names))))))) ================================================================================ import: qualified basic ================================================================================ import qualified Aaa.A import qualified A () import qualified Aaa.A (a) import Aaa.A qualified (a) import qualified Aaa.A hiding (A, a) -------------------------------------------------------------------------------- (haskell (imports (import (module (module_id) (module_id))) (import (module (module_id)) (import_list)) (import (module (module_id) (module_id)) (import_list (import_name (variable)))) (import (module (module_id) (module_id)) (import_list (import_name (variable)))) (import (module (module_id) (module_id)) (import_list (import_name (name)) (import_name (variable)))))) ================================================================================ import: qualified as ================================================================================ module A where import qualified Aaa.A as A import qualified Aaa.A as A (A(A, a), aa) import qualified A as A () -- a import qualified Aaa.A as A import qualified Aaa.A as Aaa.A import qualified Aaa.A as A hiding (a) data A = A -------------------------------------------------------------------------------- (haskell (header (module (module_id))) (imports (import (module (module_id) (module_id)) (module (module_id))) (import (module (module_id) (module_id)) (module (module_id)) (import_list (import_name (name) (children (constructor) (variable))) (import_name (variable)))) (import (module (module_id)) (module (module_id)) (import_list)) (comment) (import (module (module_id) (module_id)) (module (module_id))) (import (module (module_id) (module_id)) (module (module_id) (module_id))) (import (module (module_id) (module_id)) (module (module_id)) (import_list (import_name (variable))))) (declarations (data_type (name) (data_constructors (data_constructor (prefix (constructor))))))) ================================================================================ import: prim ================================================================================ import Aaa.Aa (Aa#, aa#) -------------------------------------------------------------------------------- (haskell (imports (import (module (module_id) (module_id)) (import_list (import_name (name)) (import_name (variable)))))) ================================================================================ import: package ================================================================================ import "a" Aaa.Aa import qualified "a" Aaa.Aa as Aa (Aa(a)) -------------------------------------------------------------------------------- (haskell (imports (import (import_package) (module (module_id) (module_id))) (import (import_package) (module (module_id) (module_id)) (module (module_id)) (import_list (import_name (name) (children (variable))))))) ================================================================================ import: consym ================================================================================ import A ((:<|>)((:<|>))) -------------------------------------------------------------------------------- (haskell (imports (import (module (module_id)) (import_list (import_name (prefix_id (constructor_operator)) (children (prefix_id (constructor_operator)))))))) ================================================================================ import: operator ================================================================================ import A ((<=<)) -------------------------------------------------------------------------------- (haskell (imports (import (module (module_id)) (import_list (import_name (prefix_id (operator))))))) ================================================================================ import: pattern/type ================================================================================ import A (pattern A, type A) -------------------------------------------------------------------------------- (haskell (imports (import (module (module_id)) (import_list (import_name (namespace) (name)) (import_name (namespace) (name)))))) ================================================================================ import: trailing comma ================================================================================ import A (A,) -------------------------------------------------------------------------------- (haskell (imports (import (module (module_id)) (import_list (import_name (name)))))) ================================================================================ import: type operator with namespace ================================================================================ import A (type (++)(..)) -------------------------------------------------------------------------------- (haskell (imports (import (module (module_id)) (import_list (import_name (namespace) (prefix_id (operator)) (children (all_names))))))) ================================================================================ import: namespace for type child ================================================================================ import A (A (type A, A, ..)) -------------------------------------------------------------------------------- (haskell (imports (import (module (module_id)) (import_list (import_name (name) (children (associated_type (name)) (constructor) (all_names))))))) ================================================================================ import: partially typed import before the end of the block ================================================================================ import A impo import A -------------------------------------------------------------------------------- (haskell (imports (import (module (module_id)))) (declarations (top_splice (variable)) (import (module (module_id))))) ================================================ FILE: test/corpus/instance.txt ================================================ ================================================================================ instance: minimal ================================================================================ instance A a -------------------------------------------------------------------------------- (haskell (declarations (instance (name) (type_patterns (variable))))) ================================================================================ instance: type ================================================================================ instance A A a A -------------------------------------------------------------------------------- (haskell (declarations (instance (name) (type_patterns (name) (variable) (name))))) ================================================================================ instance: forall ================================================================================ instance forall a (a :: *) . A -------------------------------------------------------------------------------- (haskell (declarations (instance (forall (quantified_variables (variable) (parens (annotated (variable) (star))))) (name)))) ================================================================================ instance: context ================================================================================ instance A a => A instance (A a, A a) => A -------------------------------------------------------------------------------- (haskell (declarations (instance (context (apply (name) (variable))) (name)) (instance (context (tuple (apply (name) (variable)) (apply (name) (variable)))) (name)))) ================================================================================ instance: method inline ================================================================================ instance A a where a a = Just a -------------------------------------------------------------------------------- (haskell (declarations (instance (name) (type_patterns (variable)) (instance_declarations (function (variable) (patterns (variable)) (match (apply (constructor) (variable)))))))) ================================================================================ instance: signature ================================================================================ instance A a where a :: A a => a -> a a a = a -------------------------------------------------------------------------------- (haskell (declarations (instance (name) (type_patterns (variable)) (instance_declarations (signature (variable) (context (apply (name) (variable)) (function (variable) (variable)))) (function (variable) (patterns (variable)) (match (variable))))))) ================================================================================ instance: infix context ================================================================================ instance a + a => A -------------------------------------------------------------------------------- (haskell (declarations (instance (context (infix (variable) (operator) (variable))) (name)))) ================================================================================ instance: equality constraint ================================================================================ instance A a ~ A a => A a instance A ~~ A => ((A) a) -------------------------------------------------------------------------------- (haskell (declarations (instance (context (infix (apply (name) (variable)) (operator) (apply (name) (variable)))) (name) (type_patterns (variable))) (instance (context (infix (name) (operator) (name))) (parens (parens (name)) (type_patterns (variable)))))) ================================================================================ instance: associated type instance ================================================================================ instance A where type A A a = A a type instance A @A a = A -------------------------------------------------------------------------------- (haskell (declarations (instance (name) (instance_declarations (type_instance (name) (type_patterns (name) (variable)) (apply (name) (variable))) (type_instance (name) (type_patterns (kind_application (name)) (variable)) (name)))))) ================================================================================ instance: associated data instance ================================================================================ instance A where data A a = A a | A { a :: A } data instance ∀ a . A a => A a = A newtype A A where A :: A %1 -> A A -------------------------------------------------------------------------------- (haskell (declarations (instance (name) (instance_declarations (data_instance (data_type (name) (type_patterns (variable)) (data_constructors (data_constructor (prefix (constructor) (variable))) (data_constructor (record (constructor) (fields (field (field_name (variable)) (name)))))))) (data_instance (data_type (forall (quantified_variables (variable))) (context (apply (name) (variable))) (name) (type_patterns (variable)) (data_constructors (data_constructor (prefix (constructor)))))) (data_instance (newtype (name) (type_patterns (name)) (gadt_constructors (gadt_constructor (constructor) (prefix (linear_function (name) (modifier (literal (integer))) (apply (name) (name)))))))))))) ================================================================================ instance: infix pattern lhs method ================================================================================ instance A where a == a = a -------------------------------------------------------------------------------- (haskell (declarations (instance (name) (instance_declarations (function (infix (variable) (operator) (variable)) (match (variable))))))) ================================================================================ instance: standalone deriving ================================================================================ deriving instance A (A a) deriving instance A ++ A deriving instance A a => A (A a) deriving instance (A a, A a a) => A (A a) -------------------------------------------------------------------------------- (haskell (declarations (deriving_instance (name) (type_patterns (parens (apply (name) (variable))))) (deriving_instance (infix (name) (operator) (name))) (deriving_instance (context (apply (name) (variable))) (name) (type_patterns (parens (apply (name) (variable))))) (deriving_instance (context (tuple (apply (name) (variable)) (apply (apply (name) (variable)) (variable)))) (name) (type_patterns (parens (apply (name) (variable))))))) ================================================================================ instance: deriving via ================================================================================ deriving via (A a) instance A a -------------------------------------------------------------------------------- (haskell (declarations (deriving_instance (via (parens (apply (name) (variable)))) (name) (type_patterns (variable))))) ================================================================================ instance: qualified class ================================================================================ instance A.A a -------------------------------------------------------------------------------- (haskell (declarations (instance (qualified (module (module_id)) (name)) (type_patterns (variable))))) ================================================================================ instance: nullary method ================================================================================ instance A where a = a -------------------------------------------------------------------------------- (haskell (declarations (instance (name) (instance_declarations (bind (variable) (match (variable))))))) ================================================================================ instance: annotation ================================================================================ instance (A :: Constraint) instance ((A :: Type -> Constraint) A :: Constraint) -------------------------------------------------------------------------------- (haskell declarations: (declarations (instance (parens name: (name) kind: (name))) (instance (parens (parens name: (name) kind: (function parameter: (name) result: (name))) patterns: (type_patterns (name)) kind: (name))))) ================================================================================ instance: minus ================================================================================ instance a - b where -------------------------------------------------------------------------------- (haskell (declarations (instance (infix (variable) (operator) (variable))))) ================================================ FILE: test/corpus/layout.txt ================================================ ================================================================================ layout: where on same level as case alt with nothing following ================================================================================ a = case a of a -> a where a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (case (variable) (alternatives (alternative (variable) (match (variable)))))) (local_binds (bind (variable) (match (variable))))))) ================================================================================ layout: error: where on same level as case alt with following alt ================================================================================ a = case a of a -> a where a = a a -> a -------------------------------------------------------------------------------- (haskell (ERROR (bind (variable) (match (case (variable) (alternatives (alternative (variable) (match (variable)))))) (local_binds (bind (variable) (match (variable))))) (variable)) (declarations (top_splice (variable)))) ================================================================================ layout: where on deeper level than case alt with following alt ================================================================================ a = case a of b -> c where d = e f -> g -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (case (variable) (alternatives (alternative (variable) (match (variable)) (local_binds (bind (variable) (match (variable))))) (alternative (variable) (match (variable))))))))) ================================================================================ layout: where with subsequent top decl ================================================================================ a = a where a = a a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable)) (local_binds (bind (variable) (match (variable))))) (bind (variable) (match (variable))))) ================================================================================ layout: indented empty where with subsequent top decl ================================================================================ a = a where a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))) (bind (variable) (match (variable))))) ================================================================================ layout: where after case alt in do, then immediate top level where indented equally ================================================================================ x = do a <- b case c of _ -> d where e = f where g = h -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (bind (variable) (variable)) (exp (case (variable) (alternatives (alternative (wildcard) (match (variable)) (local_binds (bind (variable) (match (variable)))))))))) (local_binds (bind (variable) (match (variable))))))) ================================================================================ layout: double where in lambda case in do ================================================================================ x = do \case _ -> d where e = f where g = h -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (exp (lambda_case (alternatives (alternative (wildcard) (match (variable)) (local_binds (bind (variable) (match (variable)))))))))) (local_binds (bind (variable) (match (variable))))))) ================================================================================ layout: double where in lambda cases in do ================================================================================ x = do \cases _ _ -> d where e = f where g = h -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (exp (lambda_cases (alternatives (alternative (patterns (wildcard) (wildcard)) (match (variable)) (local_binds (bind (variable) (match (variable)))))))))) (local_binds (bind (variable) (match (variable))))))) ================================================================================ layout: where after case alt in do, then immediate toplevel where at do indent ================================================================================ a = do case a of a -> a where a = a where a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (exp (case (variable) (alternatives (alternative (variable) (match (variable)) (local_binds (bind (variable) (match (variable)))))))))) (local_binds (bind (variable) (match (variable))))))) ================================================================================ layout: where after case alt inline, then immediate toplevel where at case indent ================================================================================ f = case a of a -> a where a = a where a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (case (variable) (alternatives (alternative (variable) (match (variable)) (local_binds (bind (variable) (match (variable)))))))) (local_binds (bind (variable) (match (variable))))))) ================================================================================ layout: where inline after do statement ================================================================================ a = do a where a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (exp (variable)))) (local_binds (bind (variable) (match (variable))))))) ================================================================================ layout: do nested ================================================================================ x = do a b do c d do e f g h -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (exp (variable)) (exp (variable)) (exp (do (exp (variable)) (exp (variable)) (exp (do (exp (variable)) (exp (variable)))) (exp (variable)))) (exp (variable))))))) ================================================================================ layout: do and indented where ================================================================================ a = do b where c = d -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (exp (variable)))) (local_binds (bind (variable) (match (variable))))))) ================================================================================ layout: if and indented where ================================================================================ a = if | b -> c where d = e -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (multi_way_if (match (guards (boolean (variable))) (variable)))) (local_binds (bind (variable) (match (variable))))))) ================================================================================ layout: do and empty line ================================================================================ a = do a <- a a <- a a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (bind (variable) (variable)) (bind (variable) (variable)) (exp (variable))))))) ================================================================================ layout: recursive do with rec keyword ================================================================================ f = mdo a <- pure 5 rec b <- pure c c <- pure b pure c -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (bind (variable) (apply (variable) (literal (integer)))) (rec (bind (variable) (apply (variable) (variable))) (bind (variable) (apply (variable) (variable)))) (exp (apply (variable) (variable)))))))) ================================================================================ layout: in after let on same indent ================================================================================ a = let a = a in a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (let_in (local_binds (bind (variable) (match (variable)))) (variable)))))) ================================================================================ layout: identifier named "whe" in place of valid "where" in case ================================================================================ a = case b of whe -> d where -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (case (variable) (alternatives (alternative (variable) (match (variable))))))))) ================================================================================ layout: identifier named "whe" in place of valid "where" as topdecl ================================================================================ a = a whe = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))) (bind (variable) (match (variable))))) ================================================================================ layout: identifier "i" should not prematurely fail the scanner due to "in" parser ================================================================================ a (i:a) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (parens (infix (variable) (constructor_operator) (variable)))) (match (variable))))) ================================================================================ layout: empty file ================================================================================ -------------------------------------------------------------------------------- (haskell) ================================================================================ layout: indented let/in ================================================================================ a = let a = let a = a in a in do a <- a a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (let_in (local_binds (bind (variable) (match (let_in (local_binds (bind (variable) (match (variable)))) (variable))))) (do (bind (variable) (variable)) (exp (variable)))))))) ================================================================================ layout: let layout ended by in with smaller indent ================================================================================ a = let a = a in a a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (let_in (local_binds (bind (variable) (match (variable)))) (variable)))) (bind (variable) (match (variable))))) ================================================================================ layout: let layout ended by in with larger indent ================================================================================ a = let a = a in a a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (let_in (local_binds (bind (variable) (match (variable)))) (variable)))) (bind (variable) (match (variable))))) ================================================================================ layout: let with explicit semicolon ================================================================================ a = let a = a; a = a in a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (let_in (local_binds (bind (variable) (match (variable))) (bind (variable) (match (variable)))) (variable)))))) ================================================================================ layout: let with multiple explicit semicolons before and after newline ================================================================================ a = let a = a;;;;; ;;;;a = a in a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (let_in (local_binds (bind (variable) (match (variable))) (bind (variable) (match (variable)))) (variable)))))) ================================================================================ layout: let with explicit braces ================================================================================ a = let { a :: A; a = a; a :: A; a = a; } in a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (let_in (local_binds (signature (variable) (name)) (bind (variable) (match (variable))) (signature (variable) (name)) (bind (variable) (match (variable)))) (variable)))))) ================================================================================ layout: where in do-let binding ================================================================================ a = do let a = a where a = a a a = do let a = a where a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (let (local_binds (bind (variable) (match (variable)) (local_binds (bind (variable) (match (variable))))))) (exp (variable))))) (bind (variable) (match (do (let (local_binds (bind (variable) (match (variable))))) (exp (variable))))))) ================================================================================ layout: conditional with explicit semicolon ================================================================================ a = if a; then a;;; else a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (conditional (variable) (variable) (variable)))))) ================================================================================ layout: where after statement, on deeper or same indent ================================================================================ a = do b where d = e a = do b where d = e -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (exp (variable)))) (local_binds (bind (variable) (match (variable))))) (bind (variable) (match (do (exp (variable)))) (local_binds (bind (variable) (match (variable))))))) ================================================================================ layout: empty where, then indented binds after inline where ================================================================================ c = d where e = f where g = h i = j -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))) (bind (variable) (match (variable)) (local_binds (bind (variable) (match (variable))))) (bind (variable) (match (variable))))) ================================================================================ layout: parenthesized case inline ================================================================================ a = (\case a -> b) . c -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (parens (lambda_case (alternatives (alternative (variable) (match (variable)))))) (operator) (variable)))))) ================================================================================ layout: parenthesized case newline ================================================================================ a = (\case a -> b ) . c -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (parens (lambda_case (alternatives (alternative (variable) (match (variable)))))) (operator) (variable)))))) ================================================================================ layout: comment between where and decl ================================================================================ a = b where {- comment -} c = d a = b where -- comment c = d a = b where -- comment c = d a = b where {- comment -} c = d a = b where -1 = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable)) (comment) (local_binds (bind (variable) (match (variable))))) (bind (variable) (match (variable)) (comment) (local_binds (bind (variable) (match (variable))))) (bind (variable) (match (variable)) (comment) (local_binds (bind (variable) (match (variable))))) (bind (variable) (match (variable)) (comment) (local_binds (bind (variable) (match (variable))))) (bind (variable) (match (variable)) (local_binds (bind (negation (integer)) (match (variable))))))) ================================================================================ layout: comment in empty where on next line indented ================================================================================ a = a where {- comment -} a = a where -- a = b where {- comment -} c = d -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))) (comment) (bind (variable) (match (variable))) (comment) (bind (variable) (match (variable))) (comment) (bind (variable) (match (variable))))) ================================================================================ layout: module in first line ================================================================================ module A where a = a -------------------------------------------------------------------------------- (haskell (header (module (module_id))) (declarations (bind (variable) (match (variable))))) ================================================================================ layout: empty line before module ================================================================================ module A where a = a -------------------------------------------------------------------------------- (haskell (header (module (module_id))) (declarations (bind (variable) (match (variable))))) ================================================================================ layout: indented module keyword, binds further left ================================================================================ module A where a = a -------------------------------------------------------------------------------- (haskell (header (module (module_id))) (declarations (bind (variable) (match (variable))))) ================================================================================ layout: closing exports paren in column 0 ================================================================================ module A ( ) where a = a -------------------------------------------------------------------------------- (haskell (header (module (module_id)) (exports)) (declarations (bind (variable) (match (variable))))) ================================================================================ layout: comment in column 0 before first decl in column 2 ================================================================================ -- a a = a -------------------------------------------------------------------------------- (haskell (comment) (declarations (bind (variable) (match (variable))))) ================================================================================ layout: decl in line 0 ================================================================================ a = a a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))) (bind (variable) (match (variable))))) ================================================================================ layout: module with smaller indent after nonzero indent at top level ================================================================================ module A where -- Lenient, see end_layout_indent #define foo data A instance A -------------------------------------------------------------------------------- (haskell (header (module (module_id))) (comment) (cpp) (declarations (data_type (name)) (instance (name)))) ================================================================================ layout: smaller indent after nonzero indent at top level ================================================================================ -- a #define foo data A instance A -- This could be an error like above, but there's no point in being strict. -------------------------------------------------------------------------------- (haskell (comment) (cpp) (declarations (data_type (name)) (instance (name)) (comment))) ================================================================================ layout: end two layouts at the same position ================================================================================ a = case a of a -> do a a :: a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (case (variable) (alternatives (alternative (variable) (match (do (exp (variable))))))))) (signature (variable) (variable)))) ================================================================================ layout: case in a list terminated by bracket ================================================================================ a = [case a of a -> a] a = [case a of a -> a ] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (list (case (variable) (alternatives (alternative (variable) (match (variable)))))))) (bind (variable) (match (list (case (variable) (alternatives (alternative (variable) (match (variable)))))))))) ================================================================================ layout: case in a list terminated by comma ================================================================================ a = [case a of a -> a, a] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (list (case (variable) (alternatives (alternative (variable) (match (variable))))) (variable)))))) ================================================================================ layout: case in a list terminated by comprehension bar ================================================================================ a = [case a of a -> a | a <- a] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (list_comprehension (case (variable) (alternatives (alternative (variable) (match (variable))))) (qualifiers (generator (variable) (variable)))))))) ================================================================================ layout: case in an explicitly braced do terminated by brace ================================================================================ a = do { case a of a -> a } -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (exp (case (variable) (alternatives (alternative (variable) (match (variable))))))))))) ================================================================================ layout: empty do statements with explicit braces ================================================================================ a = do { ; a ;;;; a ; } -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (exp (variable)) (exp (variable))))))) ================================================================================ layout: empty brace layout ================================================================================ a = case a of {} a = case a of { } a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (case (variable) (alternatives)))) (bind (variable) (match (case (variable) (alternatives)))) (bind (variable) (match (variable))))) ================================================================================ layout: end in tuple ================================================================================ a = ( case a of a -> a a -> a, a, case a of a -> a a -> a ) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (tuple (case (variable) (alternatives (alternative (variable) (match (variable))) (alternative (variable) (match (variable))))) (variable) (case (variable) (alternatives (alternative (variable) (match (variable))) (alternative (variable) (match (variable)))))))))) ================================================================================ layout: do in an if block ================================================================================ a = if do a; a then a else a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (conditional (do (exp (variable)) (exp (variable))) (variable) (variable)))))) ================================================================================ layout: do in an if-then block ================================================================================ a = if a then do a; a else a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (conditional (variable) (do (exp (variable)) (exp (variable))) (variable)))))) ================================================================================ layout: nondecreasing indent for do in if-then ================================================================================ a = do a <- a if a then do a <- a pure a else a a <- a pure a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (bind (variable) (variable)) (exp (conditional (variable) (do (bind (variable) (variable)) (exp (apply (variable) (variable)))) (variable))) (bind (variable) (variable)) (exp (apply (variable) (variable)))))))) ================================================================================ layout: do not emit newline semicolon if the first token is "then" or "else" ================================================================================ a = do a <- a if a then a else do a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (bind (variable) (variable)) (exp (conditional (variable) (variable) (do (exp (variable)))))))))) ================================================================================ layout: infix in statement position ends layout ================================================================================ a = do a >>= a a = do a `a` a a = do a -- a >>= a a = \case a -> pure a =<< a -- don't end here a = \case a -> a =<< a a -> a a = do a {-# prag #-} >>= a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (do (exp (variable))) (operator) (variable)))) (bind (variable) (match (infix (do (exp (variable))) (infix_id (variable)) (variable)))) (bind (variable) (match (infix (do (exp (variable)) (comment)) (operator) (variable)))) (bind (variable) (match (infix (lambda_case (alternatives (alternative (variable) (match (apply (variable) (variable)))))) (operator) (variable)))) (comment) (bind (variable) (match (lambda_case (alternatives (alternative (variable) (match (infix (variable) (operator) (variable)))) (alternative (variable) (match (variable))))))) (bind (variable) (match (infix (do (exp (variable)) (pragma)) (operator) (variable)))))) ================================================================================ layout: two lines starting with m without leading newline or module ================================================================================ m1 :: a -> a m1 = a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (function (variable) (variable))) (bind (variable) (match (variable))))) ================================================================================ layout: do not end do layout with bang pattern ================================================================================ a = do a <- a !a <- a ~a <- a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (bind (variable) (variable)) (bind (strict (variable)) (variable)) (bind (irrefutable (variable)) (variable))))))) ================================================================================ layout: let/in after do ================================================================================ a = do let g = a in a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (exp (let_in (local_binds (bind (variable) (match (variable)))) (variable)))))))) ================================================================================ layout: expr after newline in exp_in, with layout ended by "in" token ================================================================================ a = let a = case a of a -> a in a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (let_in (local_binds (bind (variable) (match (case (variable) (alternatives (alternative (variable) (match (variable)))))))) (variable)))))) ================================================================================ layout: instance after where, triggers rule for "in" token ================================================================================ class A where instance A -------------------------------------------------------------------------------- (haskell (declarations (class (name)) (instance (name)))) ================================================================================ layout: carriage return ================================================================================ a = a a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))) (bind (variable) (match (variable))))) ================================================================================ layout: error: unparenthesized multi-way if in list comprehension result ================================================================================ a = [if | a -> a | a <- a] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (list (ERROR (match (guards (boolean (variable))) (variable)) (guards (pattern_guard (variable) (variable))))))))) ================================================================================ layout: newline after record brace in pattern ================================================================================ a = \case A{} -> a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (lambda_case (alternatives (alternative (record (constructor)) (match (variable))))))))) ================================================================================ layout: signature with function arrow on new line with two chars of indent ================================================================================ a :: A -> A a = a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (function (name) (name))) (bind (variable) (match (variable))))) ================================================================================ layout: same indent is permitted for multi-way if ================================================================================ a = if | a -> a a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (multi_way_if (match (guards (boolean (variable))) (variable))) (variable)))))) ================================================================================ layout: close layout in guard at comma ================================================================================ a | case a of _ -> a, a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (guards (boolean (case (variable) (alternatives (alternative (wildcard) (match (variable)))))) (boolean (variable))) (variable))))) ================================================================================ layout: obscure canary for pat prec bugs ================================================================================ a = do a a a :: A (A [(A, A)]) a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (exp (apply (variable) (variable)))))) (signature (variable) (apply (name) (parens (apply (name) (list (tuple (name) (name))))))) (bind (variable) (match (variable))))) ================================================================================ layout: bar operator in case layout in texp ================================================================================ a = ( case a of a -> a || a a -> a ) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (parens (case (variable) (alternatives (alternative (variable) (match (infix (variable) (operator) (variable)))) (alternative (variable) (match (variable)))))))))) ================================================================================ layout: unboxed texp ================================================================================ a = (# a, case a of a -> a #) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (unboxed_tuple (variable) (case (variable) (alternatives (alternative (variable) (match (variable)))))))))) ================================================================================ layout: only end on bar if guard is not valid ================================================================================ a = [case a of a | a -> a | a -> a, a] --- -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (list (case (variable) (alternatives (alternative (variable) (match (guards (boolean (variable))) (variable)) (match (guards (boolean (variable))) (variable))))) (variable)))) (comment))) ================================================================================ layout: closing brace before cpp else ================================================================================ #if a a = case a of {} #else a = a #endif a = a -------------------------------------------------------------------------------- (haskell (cpp) (declarations (bind (variable) (match (case (variable) (alternatives)))) (cpp) (cpp) (bind (variable) (match (variable))))) ================================================================================ layout: brace layout in virtual layout ending at the same position ================================================================================ a = do a do { a } a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (exp (apply (variable) (do (exp (variable)))))))) (bind (variable) (match (variable))))) ================================================================================ layout: strict data field after newline ================================================================================ data A = A !A ~A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (prefix (constructor) (strict_field (name)) (lazy_field (name)))))))) ================================================================================ layout: splice in do statement ================================================================================ a = do $a a <- a $$a a <- a a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (exp (splice (variable))) (bind (variable) (variable)) (exp (splice (variable))) (bind (variable) (variable)) (exp (variable))))))) ================================================================================ layout: modifier at start of line ================================================================================ a :: a %1 -> a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (linear_function (variable) (modifier (literal (integer))) (variable))))) ================================================================================ layout: composition dot after newline ================================================================================ a = a . a a = ( a . a ) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (parens (infix (variable) (operator) (variable))))))) ================================================================================ layout: comment before module without newline ================================================================================ {- a -} module A where a = a -------------------------------------------------------------------------------- (haskell (comment) (header (module (module_id))) (declarations (bind (variable) (match (variable))))) ================================================================================ layout: pragma, module, import ================================================================================ {-# language NoHaskell #-} module A where import A -------------------------------------------------------------------------------- (haskell (pragma) (header (module (module_id))) (imports (import (module (module_id))))) ================================================================================ layout: newline, pragma, module, import ================================================================================ {-# language NoHaskell #-} module A where import A -------------------------------------------------------------------------------- (haskell (pragma) (header (module (module_id))) (imports (import (module (module_id))))) ================================================================================ layout: function starting with special token ================================================================================ -- Newline lookahead has a special case for 'then' and 'else', which has the -- potential to prevent a semi a = a then' = a elsex = a -------------------------------------------------------------------------------- (haskell (comment) (declarations (bind (variable) (match (variable))) (bind (variable) (match (variable))) (bind (variable) (match (variable))))) ================================================================================ layout: case in let, single line ================================================================================ a = let a = case a of a -> a in a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (let_in (local_binds (bind (variable) (match (case (variable) (alternatives (alternative (variable) (match (variable)))))))) (variable)))))) ================================================================================ layout: do in case in nested let, single line ================================================================================ a = let a = let a = case a of a -> do a in a in a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (let_in (local_binds (bind (variable) (match (let_in (local_binds (bind (variable) (match (case (variable) (alternatives (alternative (variable) (match (do (exp (variable)))))))))) (variable))))) (variable)))))) ================================================================================ layout: "the" at end of file ================================================================================ a = the -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))))) ================================================================================ layout: obscure case where eof layout end happens prematurely without no_lookahead check ================================================================================ a = a where a = do let a = a a `a` if a then a else a e -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable)) (local_binds (bind (variable) (match (infix (do (let (local_binds (bind (variable) (match (variable))))) (exp (variable))) (infix_id (variable)) (conditional (variable) (variable) (apply (variable) (variable)))))))))) ================================================================================ layout: space at eof ================================================================================ -- This test only has a purpose when looking at scanner debug output. -- If we don't mark after skipped space at eof, the scanner gets called again. module A where a = a -------------------------------------------------------------------------------- (haskell (comment) (header (module (module_id))) (declarations (bind (variable) (match (variable))))) ================================================================================ layout: braces on new line ================================================================================ a = do { a } -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (exp (variable))))))) ================================================================================ layout: allow any indent nested in brace layout ================================================================================ a = do do { case a of a -> a } -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (exp (do (exp (case (variable) (alternatives (alternative (variable) (match (variable))))))))))))) ================================================================================ layout: let guard in decl ================================================================================ a | let a = a = a a | let a = a == a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (guards (let (local_binds (bind (variable) (match (variable)))))) (variable))) (bind (variable) (match (guards (let (local_binds (bind (variable) (match (infix (variable) (operator) (variable))))))) (variable))))) ================================================================================ layout: do expr in guard ================================================================================ a | do a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (guards (boolean (do (exp (variable))))) (variable))))) ================================================================================ layout: case in guard ================================================================================ a | case a of a -> a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (guards (boolean (case (variable) (alternatives (alternative (variable) (match (variable))))))) (variable))))) ================================================================================ layout: multi-way if in guard ================================================================================ a | if | a -> a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (guards (boolean (multi_way_if (match (guards (boolean (variable))) (variable))))) (variable))))) ================================================================================ layout: let guard in case ================================================================================ a = case a of a | let a = a -> a a = case a of a | let a = a → a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (case (variable) (alternatives (alternative (variable) (match (guards (let (local_binds (bind (variable) (match (variable)))))) (variable))))))) (bind (variable) (match (case (variable) (alternatives (alternative (variable) (match (guards (let (local_binds (bind (variable) (match (variable)))))) (variable))))))))) ================================================================================ layout: signature with arrow in let in texp ================================================================================ a = (let a :: a -> a in a) a = (let a :: ∀ a -> a -> a in a) a = (let (a -> a) = a in a) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (parens (let_in (local_binds (signature (variable) (function (variable) (variable)))) (variable))))) (bind (variable) (match (parens (let_in (local_binds (signature (variable) (forall_required (quantified_variables (variable)) (function (variable) (variable))))) (variable))))) (bind (variable) (match (parens (let_in (local_binds (bind (parens (view_pattern (variable) (variable))) (match (variable)))) (variable))))))) ================================================================================ layout: guard bar ends layout at the same indent ================================================================================ a | a = do let a = a a | a = a a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (guards (boolean (variable))) (do (let (local_binds (bind (variable) (match (variable))))) (exp (variable)))) (match (guards (boolean (variable))) (variable))) (bind (variable) (match (variable))))) ================================================================================ layout: symop dot ends layout ================================================================================ a = do a . a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (do (exp (variable))) (operator) (variable)))))) ================================================================================ layout: symop hash ends layout ================================================================================ a = do a # a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (do (exp (variable))) (operator) (variable)))))) ================================================================================ layout: do in then branch in another do with else in indent column ================================================================================ a = do if a then do a else a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (exp (conditional (variable) (do (exp (variable))) (variable)))))))) ================================================================================ layout: explicit semicolon between topdecls ================================================================================ a = a; a = a; a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))) (bind (variable) (match (variable))) (bind (variable) (match (variable))))) ================================================================================ layout: semicolon after last statement in do ================================================================================ a = do a; a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (exp (variable))))) (bind (variable) (match (variable))))) ================================================================================ layout: do-let layout ended by indent of next statement with leading semicolon ================================================================================ a = do ; let a = a ; a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (let (local_binds (bind (variable) (match (variable))))) (exp (variable))))))) ================================================================================ layout: random indent with leading semicolons in do ================================================================================ a = do ; a ; a ; a ; a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (exp (variable)) (exp (variable)) (exp (variable)) (exp (variable))))))) ================================================================================ layout: pragmas, cpp, then module ================================================================================ {-# prag #-} #include "a" module A (A (..)) where -------------------------------------------------------------------------------- (haskell (pragma) (cpp) (header (module (module_id)) (exports (export (name) (children (all_names)))))) ================================================================================ layout: semicolon at beginning of file ================================================================================ ; a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))))) ================================================================================ layout: semicolon before imports ================================================================================ module A where ; import A -------------------------------------------------------------------------------- (haskell (header (module (module_id))) (imports (import (module (module_id))))) ================================================================================ layout: brace layout after comment ================================================================================ a = do {- -} { a <- a } -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (comment) (bind (variable) (variable))))))) ================================================================================ layout: brace layout after pragma ================================================================================ a = do {-# prag #-} { a <- a } -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (pragma) (bind (variable) (variable))))))) ================================================================================ layout: brace layout in first column ================================================================================ { a = a } -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))))) ================================================================================ layout: empty brace alternatives separated from case by comment ================================================================================ a = case a of -- a {} -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (case (variable) (comment) (alternatives)))))) ================================================================================ layout: comment before multi-way if bar on newline ================================================================================ -- This is only relevant for the scanner –` `newline_lookahead sets a flag when -- encountering the bar, which is read by `start_layout_newline` to decide that -- an MWI layout is valid and emit it right away, rather than deferring to the -- next run with `interior`. a = if {- a -} | a -> a -------------------------------------------------------------------------------- (haskell (comment) (declarations (bind (variable) (match (multi_way_if (comment) (match (guards (boolean (variable))) (variable))))))) ================================================================================ layout: block comment at eof without newline ================================================================================ a = a {- a -} -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable)))) (comment)) ================================================================================ layout: unicode whitespace ================================================================================ a = case a of a -> a -- This line's leading whitespace consists of all 17 code points of the General -- Category Zs. -- Take care not to replace them! (This should probably be a generated test) -- That dash character is the Ogham Space Mark, and the last character is extra -- wide.                 a -> a a -> a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (case (variable) (alternatives (alternative (variable) (match (variable))) (comment) (alternative (variable) (match (variable))) (alternative (variable) (match (variable))))))))) ================================================================================ layout: inline braces followed by layout semicolon ================================================================================ a = case a of { a -> a; } a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (case (variable) (alternatives (alternative (variable) (match (variable))))))) (bind (variable) (match (variable))))) ================================================================================ layout: nonzero toplevel indent ================================================================================ a = a a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))) (bind (variable) (match (variable))))) ================================================================================ layout: comment after semicolon ================================================================================ a :: a; -- a a :: a; {- a -} a = a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (variable)) (comment) (signature (variable) (variable)) (comment) (bind (variable) (match (variable))))) ================================================================================ layout: comment and pragma after semicolon with following layout element ================================================================================ x = let a = 1; b = 2 c = 3; {- x -} d = 4; {- x -} e = 5 f = 6; {-# x #-} g = 7; {-# x #-} h = 8 i = 9 in c -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (let_in (local_binds (bind (variable) (match (literal (integer)))) (bind (variable) (match (literal (integer)))) (bind (variable) (match (literal (integer)))) (comment) (bind (variable) (match (literal (integer)))) (comment) (bind (variable) (match (literal (integer)))) (bind (variable) (match (literal (integer)))) (pragma) (bind (variable) (match (literal (integer)))) (pragma) (bind (variable) (match (literal (integer)))) (bind (variable) (match (literal (integer))))) (variable)))))) ================================================================================ layout: list pattern in let ================================================================================ a = let [a] = a in a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (let_in (local_binds (bind (list (variable)) (match (variable)))) (variable)))))) ================================================================================ layout: instance after splice in expression splice ================================================================================ a $(a) instance A where type A = A -------------------------------------------------------------------------------- (haskell (declarations (top_splice (apply (variable) (splice (parens (variable))))) (instance (name) (instance_declarations (type_instance (name) (name)))))) ================================================================================ layout: comment containing tab exceeding layout indent ================================================================================ a = a where a = a {- a -} a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable)) (local_binds (bind (variable) (match (apply (variable) (comment) (variable)))))))) ================================================ FILE: test/corpus/module.txt ================================================ ================================================================================ module: exports empty ================================================================================ module A () where -------------------------------------------------------------------------------- (haskell (header (module (module_id)) (exports))) ================================================================================ module: exports regular ================================================================================ module A ( a', A, A(), A(..), A(a, a), ) where -------------------------------------------------------------------------------- (haskell (header (module (module_id)) (exports (export (variable)) (export (name)) (export (name) (children)) (export (name) (children (all_names))) (export (name) (children (variable) (variable)))))) ================================================================================ module: exports symbolic ================================================================================ module A ( (<>)((:<>), A), (:++), ) where -------------------------------------------------------------------------------- (haskell (header (module (module_id)) (exports (export (prefix_id (operator)) (children (prefix_id (constructor_operator)) (constructor))) (export (prefix_id (constructor_operator)))))) ================================================================================ module: exports type ================================================================================ module A ( type A, type (<>), type (:++), ) where -------------------------------------------------------------------------------- (haskell (header (module (module_id)) (exports (export (namespace) (name)) (export (namespace) (prefix_id (operator))) (export (namespace) (prefix_id (constructor_operator)))))) ================================================================================ module: exports pattern ================================================================================ module A ( pattern A, pattern (<>), A (.., a, ..), ) where -------------------------------------------------------------------------------- (haskell (header (module (module_id)) (exports (export (namespace) (name)) (export (namespace) (prefix_id (operator))) (export (name) (children (all_names) (variable) (all_names)))))) ================================================================================ module: exports module ================================================================================ module A ( a, module A, module A.A.A, ) where -------------------------------------------------------------------------------- (haskell (header (module (module_id)) (exports (export (variable)) (module_export (module (module_id))) (module_export (module (module_id) (module_id) (module_id)))))) ================================================================================ module: exports qualified ================================================================================ module A ( A.A.a, type (A.A.++), type (A.A.:++), A.A.A, A.A.A((<=<), (:++), A, a), type A.A((>>), A), pattern A.A((>>), A), ) where -------------------------------------------------------------------------------- (haskell (header (module (module_id)) (exports (export (qualified (module (module_id) (module_id)) (variable))) (export (namespace) (prefix_id (qualified (module (module_id) (module_id)) (operator)))) (export (namespace) (prefix_id (qualified (module (module_id) (module_id)) (constructor_operator)))) (export (qualified (module (module_id) (module_id)) (name))) (export (qualified (module (module_id) (module_id)) (name)) (children (prefix_id (operator)) (prefix_id (constructor_operator)) (constructor) (variable))) (export (namespace) (qualified (module (module_id)) (name)) (children (prefix_id (operator)) (constructor))) (export (namespace) (qualified (module (module_id)) (name)) (children (prefix_id (operator)) (constructor)))))) ================================================================================ module: exports zero indent ================================================================================ module A ( A , a, A ) where -------------------------------------------------------------------------------- (haskell (header (module (module_id)) (exports (export (name)) (export (variable)) (export (name))))) ================================================================================ module: qualified ================================================================================ module A.A'.A where -------------------------------------------------------------------------------- (haskell (header (module (module_id) (module_id) (module_id)))) ================================================================================ module: export minus ================================================================================ module A (type (-), (-)) where -------------------------------------------------------------------------------- (haskell (header (module (module_id)) (exports (export (namespace) (prefix_id (operator))) (export (prefix_id (operator)))))) ================================================================================ module: export dot ================================================================================ module A (type (.), (.)) where -------------------------------------------------------------------------------- (haskell (header (module (module_id)) (exports (export (namespace) (prefix_id (operator))) (export (prefix_id (operator)))))) ================================================================================ module: no trailing comma ================================================================================ module A ( A, A ) where -------------------------------------------------------------------------------- (haskell (header (module (module_id)) (exports (export (name)) (export (name))))) ================================================================================ module: namespace for type child ================================================================================ module A ( A (type A, A, ..) ) where -------------------------------------------------------------------------------- (haskell (header (module (module_id)) (exports (export (name) (children (associated_type (name)) (constructor) (all_names)))))) ================================================ FILE: test/corpus/newtype.txt ================================================ ================================================================================ newtype: basic ================================================================================ newtype A = A A -------------------------------------------------------------------------------- (haskell (declarations (newtype (name) (newtype_constructor (constructor) (field (name)))))) ================================================================================ newtype: context ================================================================================ newtype A a => A a = A a -------------------------------------------------------------------------------- (haskell (declarations (newtype (context (apply (name) (variable))) (name) (type_params (variable)) (newtype_constructor (constructor) (field (variable)))))) ================================================================================ newtype: record ================================================================================ newtype A = A { a :: A a } -------------------------------------------------------------------------------- (haskell (declarations (newtype (name) (newtype_constructor (constructor) (record (field (field_name (variable)) (apply (name) (variable)))))))) ================================================================================ newtype: tyvar kind ================================================================================ newtype A a (a :: [* -> *]) a = A a -------------------------------------------------------------------------------- (haskell (declarations (newtype (name) (type_params (variable) (parens (annotated (variable) (list (function (star) (star))))) (variable)) (newtype_constructor (constructor) (field (variable)))))) ================================================================================ newtype: deriving ================================================================================ newtype A = A a deriving A newtype A a = A { a :: A } deriving (A, A) deriving newtype A deriving A via (A a) -------------------------------------------------------------------------------- (haskell (declarations (newtype (name) (newtype_constructor (constructor) (field (variable))) (deriving (name))) (newtype (name) (type_params (variable)) (newtype_constructor (constructor) (record (field (field_name (variable)) (name)))) (deriving (tuple (name) (name))) (deriving (deriving_strategy) (name)) (deriving (name) (via (parens (apply (name) (variable)))))))) ================================================================================ newtype: unlifted ================================================================================ newtype A :: TYPE 'A where A :: A# -> A -------------------------------------------------------------------------------- (haskell (declarations (newtype (name) (apply (name) (promoted (constructor))) (gadt_constructors (gadt_constructor (constructor) (prefix (function (name) (name)))))))) ================================================================================ newtype: prefix operator ================================================================================ newtype (++) a = (:++) a -------------------------------------------------------------------------------- (haskell (declarations (newtype (prefix_id (operator)) (type_params (variable)) (newtype_constructor (prefix_id (constructor_operator)) (field (variable)))))) ================================================ FILE: test/corpus/number.txt ================================================ ================================================================================ number: decimal ================================================================================ a = 0 a = 100_00_532 a = 55# a = 55## -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (literal (integer)))) (bind (variable) (match (literal (integer)))) (bind (variable) (match (literal (integer)))) (bind (variable) (match (literal (integer)))))) ================================================================================ number: octal ================================================================================ a = 0o00 a = 0O77 a = 0O77## -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (literal (integer)))) (bind (variable) (match (literal (integer)))) (bind (variable) (match (literal (integer)))))) ================================================================================ number: hex ================================================================================ a = 0xA8 a = 0XEF84Fe23 a = 0xa_e_123_4 a = 0xa_e_123_4## a = 0x0.1p-4 a = 0xFp3 -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (literal (integer)))) (bind (variable) (match (literal (integer)))) (bind (variable) (match (literal (integer)))) (bind (variable) (match (literal (integer)))) (bind (variable) (match (literal (integer)))) (bind (variable) (match (literal (integer)))))) ================================================================================ number: float ================================================================================ a = 0.32847283472 a = 0.00e01 a = 0.00e01# a = 0.00e+01 a = 0.99E-01 a = 00e01 a = 00e+01 a = 99E-01 -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (literal (float)))) (bind (variable) (match (literal (float)))) (bind (variable) (match (literal (float)))) (bind (variable) (match (literal (float)))) (bind (variable) (match (literal (float)))) (bind (variable) (match (literal (float)))) (bind (variable) (match (literal (float)))) (bind (variable) (match (literal (float)))))) ================================================================================ number: binary ================================================================================ a = 0b01110 a = 0B10010 a = 0B10010## -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (literal (integer)))) (bind (variable) (match (literal (integer)))) (bind (variable) (match (literal (integer)))))) ================================================ FILE: test/corpus/pat.txt ================================================ ================================================================================ pat: basic ================================================================================ a a (a:a : as) (a, a, (a, [a])) = a -------------------------------------------------------------------------------- (haskell declarations: (declarations (function name: (variable) patterns: (patterns (variable) (parens pattern: (infix left_operand: (variable) operator: (constructor_operator) right_operand: (infix left_operand: (variable) operator: (constructor_operator) right_operand: (variable)))) (tuple element: (variable) element: (variable) element: (tuple element: (variable) element: (list element: (variable))))) match: (match expression: (variable))))) ================================================================================ pat: con simple ================================================================================ a A = a a (A a) = a a (A A A) = a a (A a A (A a a A a)) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (constructor)) (match (variable))) (function (variable) (patterns (parens (apply (constructor) (variable)))) (match (variable))) (function (variable) (patterns (parens (apply (apply (constructor) (constructor)) (constructor)))) (match (variable))) (function (variable) (patterns (parens (apply (apply (apply (constructor) (variable)) (constructor)) (parens (apply (apply (apply (apply (constructor) (variable)) (variable)) (constructor)) (variable)))))) (match (variable))))) ================================================================================ pat: consym ================================================================================ a (a :++ a) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (parens (infix (variable) (constructor_operator) (variable)))) (match (variable))))) ================================================================================ pat: as ================================================================================ a a@(A a) a@(A a) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (as (variable) (parens (apply (constructor) (variable)))) (as (variable) (parens (apply (constructor) (variable))))) (match (variable))))) ================================================================================ pat: wildcard ================================================================================ a (A _) _ a@_ a@(!_) a@(~_) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (parens (apply (constructor) (wildcard))) (wildcard) (as (variable) (wildcard)) (as (variable) (parens (strict (wildcard)))) (as (variable) (parens (irrefutable (wildcard))))) (match (variable))))) ================================================================================ pat: literal ================================================================================ a 1 2 = 3 a "a" "a" = a a 'a' 'b' = a a 1.0 2.0 = 3.0 -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (literal (integer)) (literal (integer))) (match (literal (integer)))) (function (variable) (patterns (literal (string)) (literal (string))) (match (variable))) (function (variable) (patterns (literal (char)) (literal (char))) (match (variable))) (function (variable) (patterns (literal (float)) (literal (float))) (match (literal (float)))))) ================================================================================ pat: record ================================================================================ f A {} = a f A {..} = a f a@A { a = a, b = a, a, .. } = a f !A {} = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (record (constructor))) (match (variable))) (function (variable) (patterns (record (constructor) (field_pattern (wildcard)))) (match (variable))) (function (variable) (patterns (as (variable) (record (constructor) (field_pattern (field_name (variable)) (variable)) (field_pattern (field_name (variable)) (variable)) (field_pattern (field_name (variable))) (field_pattern (wildcard))))) (match (variable))) (function (variable) (patterns (strict (record (constructor)))) (match (variable))))) ================================================================================ pat: zero indent record ================================================================================ a = do A { a = a , a = a, a, .. } <- a a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (bind (record (constructor) (field_pattern (field_name (variable)) (variable)) (field_pattern (field_name (variable)) (variable)) (field_pattern (field_name (variable))) (field_pattern (wildcard))) (variable)) (exp (variable))))))) ================================================================================ pat: strict ================================================================================ a !a = a a !(!a) = a a !(!(a, a), a) ![_] !_ = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (strict (variable))) (match (variable))) (function (variable) (patterns (strict (parens (strict (variable))))) (match (variable))) (function (variable) (patterns (strict (tuple (strict (tuple (variable) (variable))) (variable))) (strict (list (wildcard))) (strict (wildcard))) (match (variable))))) ================================================================================ pat: irrefutable ================================================================================ a ~a = a a ~(~a) = a a ~(~(a, a), a) ~[_] ~_ = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (irrefutable (variable))) (match (variable))) (function (variable) (patterns (irrefutable (parens (irrefutable (variable))))) (match (variable))) (function (variable) (patterns (irrefutable (tuple (irrefutable (tuple (variable) (variable))) (variable))) (irrefutable (list (wildcard))) (irrefutable (wildcard))) (match (variable))))) ================================================================================ pat: view pattern in argument patterns ================================================================================ a (a a -> Aa a a) = a a (a -> a, a -> a) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (parens (view_pattern (apply (variable) (variable)) (apply (apply (constructor) (variable)) (variable))))) (match (variable))) (function (variable) (patterns (tuple (view_pattern (variable) (variable)) (view_pattern (variable) (variable)))) (match (variable))))) ================================================================================ pat: view pattern in lambda ================================================================================ a = \ (a -> a) -> a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (lambda (patterns (parens (view_pattern (variable) (variable)))) (variable)))))) ================================================================================ pat: parenthesized record ================================================================================ a (A{}) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (parens (record (constructor)))) (match (variable))))) ================================================================================ pat: guards ================================================================================ a a | a < 1, a > 1 = A | A (A A {..} _) : a <- a = A | otherwise = A -------------------------------------------------------------------------------- (haskell declarations: (declarations (function name: (variable) patterns: (patterns (variable)) match: (match guards: (guards guard: (boolean (infix left_operand: (variable) operator: (operator) right_operand: (literal (integer)))) guard: (boolean (infix left_operand: (variable) operator: (operator) right_operand: (literal (integer))))) expression: (constructor)) match: (match guards: (guards guard: (pattern_guard pattern: (infix left_operand: (apply function: (constructor) argument: (parens pattern: (apply function: (apply function: (constructor) argument: (record constructor: (constructor) field: (field_pattern (wildcard)))) argument: (wildcard)))) operator: (constructor_operator) right_operand: (variable)) expression: (variable))) expression: (constructor)) match: (match guards: (guards guard: (boolean (variable))) expression: (constructor))))) ================================================================================ pat: view pattern in record ================================================================================ a A { a = a -> a } = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (record (constructor) (field_pattern (field_name (variable)) (view_pattern (variable) (variable))))) (match (variable))))) ================================================================================ pat: unboxed tuple ================================================================================ a (# a, a, a #) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (unboxed_tuple (variable) (variable) (variable))) (match (variable))))) ================================================================================ pat: unboxed unit ================================================================================ a (# #) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (unboxed_unit)) (match (variable))))) ================================================================================ pat: unboxed solo ================================================================================ a (# A a #) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (unboxed_tuple (apply (constructor) (variable)))) (match (variable))))) ================================================================================ pat: unboxed sum, nullary tuple ================================================================================ a (# (# #) | | #) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (unboxed_sum (unboxed_unit))) (match (variable))))) ================================================================================ pat: signature ================================================================================ a (a :: A) = a a = do let (a :: A, a) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (parens (signature (variable) (name)))) (match (variable))) (bind (variable) (match (do (let (local_binds (bind (tuple (signature (variable) (name)) (variable)) (match (variable)))))))))) ================================================================================ pat: do binder signature ================================================================================ a = do a :: A <- a -------------------------------------------------------------------------------- (haskell declarations: (declarations (bind name: (variable) match: (match expression: (do statement: (bind pattern: (signature pattern: (variable) type: (name)) expression: (variable))))))) ================================================================================ pat: pattern binding signature ================================================================================ a :: A = a -------------------------------------------------------------------------------- (haskell (declarations (bind (signature (variable) (name)) (match (variable))))) ================================================================================ pat: do binder view pattern ================================================================================ a = do (a -> a) <- a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (bind (parens (view_pattern (variable) (variable))) (variable))))))) ================================================================================ pat: splice ================================================================================ a $(a) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (splice (parens (variable)))) (match (variable))))) ================================================================================ pat: quasiqoute ================================================================================ a [a|a|] = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (quasiquote (quoter (variable)) (quasiquote_body))) (match (variable))))) ================================================================================ pat: operator ================================================================================ a (++) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (prefix_id (operator))) (match (variable))))) ================================================================================ pat: negation ================================================================================ f (-1) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (parens (negation (integer)))) (match (variable))))) ================================================================================ pat: type binders ================================================================================ a @a (A @a @(a :: a) @(A a :: a) @(∀ a . A a :: a)) @[A a] = a a = \ @a a @a -> a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (type_binder (variable)) (parens (apply (apply (apply (apply (constructor) (type_binder (variable))) (type_binder (parens (signature (variable) (variable))))) (type_binder (parens (signature (apply (name) (variable)) (variable))))) (type_binder (parens (signature (forall (quantified_variables (variable)) (apply (name) (variable))) (variable)))))) (type_binder (list (apply (name) (variable))))) (match (variable))) (bind (variable) (match (lambda (patterns (type_binder (variable)) (variable) (type_binder (variable))) (variable)))))) ================================================================================ pat: cond in viewpat ================================================================================ a (if a then a else a -> a) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (parens (view_pattern (conditional (variable) (variable) (variable)) (variable)))) (match (variable))))) ================================================================================ pat: lambda in viewpat ================================================================================ a (\ a -> a -> a) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (parens (view_pattern (lambda (patterns (variable)) (variable)) (variable)))) (match (variable))))) ================================================================================ pat: complex viewpat ================================================================================ a (a <> if a then a else a -> a) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (parens (view_pattern (infix (variable) (operator) (conditional (variable) (variable) (variable))) (variable)))) (match (variable))))) ================================================================================ pat: error: annotation in viewpat ================================================================================ a (a :: A -> A {}) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (parens (signature (variable) (function (name) (name))) (ERROR))) (match (variable))))) ================================================================================ pat: multi viewpat ================================================================================ a (a -> a -> a -> A) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (parens (view_pattern (variable) (view_pattern (variable) (view_pattern (variable) (constructor)))))) (match (variable))))) ================================================================================ pat: ticked infix ================================================================================ a (a `A` a) = a a (a `A.A` a) = a a (A a `A` A a) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (parens (infix (variable) (infix_id (constructor)) (variable)))) (match (variable))) (function (variable) (patterns (parens (infix (variable) (infix_id (qualified (module (module_id)) (constructor))) (variable)))) (match (variable))) (function (variable) (patterns (parens (infix (apply (constructor) (variable)) (infix_id (constructor)) (apply (constructor) (variable))))) (match (variable))))) ================================================================================ pat: prefix tuple con ================================================================================ a ((,) a a) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (parens (apply (apply (prefix_tuple) (variable)) (variable)))) (match (variable))))) ================================================================================ pat: bang in case match ================================================================================ a = case a of !a -> a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (case (variable) (alternatives (alternative (strict (variable)) (match (variable))))))))) ================================================================================ pat: qualified infix ================================================================================ a (a A.:++ a) = a a (a A.A.:++ a A.A.:++ a) = a a (A a A.:++ A a) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (parens (infix (variable) (qualified (module (module_id)) (constructor_operator)) (variable)))) (match (variable))) (function (variable) (patterns (parens (infix (variable) (qualified (module (module_id) (module_id)) (constructor_operator)) (infix (variable) (qualified (module (module_id) (module_id)) (constructor_operator)) (variable))))) (match (variable))) (function (variable) (patterns (parens (infix (apply (constructor) (variable)) (qualified (module (module_id)) (constructor_operator)) (apply (constructor) (variable))))) (match (variable))))) ================================================================================ pat: explicit type binder ================================================================================ a (type a) (type (A a)) = a -------------------------------------------------------------------------------- (haskell (declarations (function (variable) (patterns (explicit_type (variable)) (explicit_type (parens (apply (name) (variable))))) (match (variable))))) ================================================ FILE: test/corpus/patsyn.txt ================================================ ================================================================================ patsyn: unidirectional simple ================================================================================ pattern A a <- a : a -------------------------------------------------------------------------------- (haskell (declarations (pattern_synonym (equation (apply (constructor) (variable)) (infix (variable) (constructor_operator) (variable)))))) ================================================================================ patsyn: unidirectional strict ================================================================================ pattern A a = A !a -------------------------------------------------------------------------------- (haskell (declarations (pattern_synonym (equation (apply (constructor) (variable)) (apply (constructor) (strict (variable))))))) ================================================================================ patsyn: explicit bidirectional list ================================================================================ pattern A a <- a : a where A a = [a] -------------------------------------------------------------------------------- (haskell (declarations (pattern_synonym (equation (apply (constructor) (variable)) (infix (variable) (constructor_operator) (variable)) (constructor_synonyms (constructor_synonym (apply (constructor) (variable)) (match (list (variable))))))))) ================================================================================ patsyn: explicit bidirectional strict ================================================================================ pattern A a <- A !a where A !a = A a -------------------------------------------------------------------------------- (haskell (declarations (pattern_synonym (equation (apply (constructor) (variable)) (apply (constructor) (strict (variable))) (constructor_synonyms (constructor_synonym (apply (constructor) (strict (variable))) (match (apply (constructor) (variable))))))))) ================================================================================ patsyn: explicit bidirectional record ================================================================================ pattern A { a } <- A a where A a = if a >= 0 then a else a -------------------------------------------------------------------------------- (haskell declarations: (declarations (pattern_synonym (equation synonym: (record constructor: (constructor) field: (field_pattern field: (field_name (variable)))) pattern: (apply function: (constructor) argument: (variable)) constructors: (constructor_synonyms (constructor_synonym pattern: (apply function: (constructor) argument: (variable)) match: (match expression: (conditional if: (infix left_operand: (variable) operator: (operator) right_operand: (literal (integer))) then: (variable) else: (variable))))))))) ================================================================================ patsyn: explicit bidirectional guards ================================================================================ pattern A a <- A a where A a | a >= 0 = (A a) | otherwise = A a -------------------------------------------------------------------------------- (haskell declarations: (declarations (pattern_synonym (equation synonym: (apply function: (constructor) argument: (variable)) pattern: (apply function: (constructor) argument: (variable)) constructors: (constructor_synonyms (constructor_synonym pattern: (apply function: (constructor) argument: (variable)) match: (match guards: (guards guard: (boolean (infix left_operand: (variable) operator: (operator) right_operand: (literal (integer))))) expression: (parens expression: (apply function: (constructor) argument: (variable)))) match: (match guards: (guards guard: (boolean (variable))) expression: (apply function: (constructor) argument: (variable))))))))) ================================================================================ patsyn: signature ================================================================================ pattern A :: A -> A -> (A, A) pattern A, A :: A -------------------------------------------------------------------------------- (haskell declarations: (declarations (pattern_synonym (signature synonym: (constructor) type: (function parameter: (name) result: (function parameter: (name) result: (tuple element: (name) element: (name)))))) (pattern_synonym (signature synonym: (binding_list name: (constructor) name: (constructor)) type: (name))))) ================================================================================ patsyn: unidirectional record ================================================================================ pattern A {a, a} = (a, a) -------------------------------------------------------------------------------- (haskell (declarations (pattern_synonym (equation (record (constructor) (field_pattern (field_name (variable))) (field_pattern (field_name (variable)))) (tuple (variable) (variable)))))) ================================================================================ patsyn: operator ================================================================================ pattern (:->) :: A pattern a :-> b <- a -------------------------------------------------------------------------------- (haskell declarations: (declarations (pattern_synonym (signature synonym: (prefix_id (constructor_operator)) type: (name))) (pattern_synonym (equation synonym: (infix left_operand: (variable) operator: (constructor_operator) right_operand: (variable)) pattern: (variable))))) ================================================================================ patsyn: ticked infix ================================================================================ pattern A <- a `A` a pattern A <- a `A.A` a -------------------------------------------------------------------------------- (haskell (declarations (pattern_synonym (equation (constructor) (infix (variable) (infix_id (constructor)) (variable)))) (pattern_synonym (equation (constructor) (infix (variable) (infix_id (qualified (module (module_id)) (constructor))) (variable)))))) ================================================ FILE: test/corpus/pragma.txt ================================================ ================================================================================ pragma: inline ================================================================================ a = a {-# inline a #-} a = a {-# inline conlike [1] a #-} a = a {-#INLINE [~2] a#-} -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))) (pragma) (bind (variable) (match (variable))) (pragma) (bind (variable) (match (variable))) (pragma))) ================================================================================ pragma: without module ================================================================================ {-# LANGUAGE LambdaCase #-} {-# language ScopedTypeVariables, DataKinds #-} -------------------------------------------------------------------------------- (haskell (pragma) (pragma)) ================================================================================ pragma: before module ================================================================================ {-# language LambdaCase #-} {-# language ScopedTypeVariables, DataKinds #-} module A where -------------------------------------------------------------------------------- (haskell (pragma) (pragma) (header (module (module_id)))) ================================================================================ pragma: after module ================================================================================ module A where {-# language X #-} a = a -------------------------------------------------------------------------------- (haskell (header (module (module_id))) (pragma) (declarations (bind (variable) (match (variable))))) ================================================================================ pragma: between imports ================================================================================ module A where {-# language X #-} import A {-# language X #-} import A {-# language X #-} a = a -------------------------------------------------------------------------------- (haskell (header (module (module_id))) (pragma) (imports (import (module (module_id))) (pragma) (import (module (module_id))) (pragma)) (declarations (bind (variable) (match (variable))))) ================================================================================ pragma: before import inline ================================================================================ module A where import A {-# language X #-} import A import A -------------------------------------------------------------------------------- (haskell (header (module (module_id))) (imports (import (module (module_id))) (pragma) (import (module (module_id))) (import (module (module_id))))) ================================================================================ pragma: instance overlap ================================================================================ instance {-# overlappable #-} A where -------------------------------------------------------------------------------- (haskell (declarations (instance (pragma) (name)))) ================================================================================ pragma: multiline ================================================================================ module A where {-# rules "a/a" [2] forall a . a a = a #-} a = a -------------------------------------------------------------------------------- (haskell (header (module (module_id))) (pragma) (declarations (bind (variable) (match (variable))))) ================================================================================ pragma: no whitespace before strictness annotation ================================================================================ data A = A {-# a #-}!A data A = A {- a -}~A -------------------------------------------------------------------------------- (haskell (declarations (data_type (name) (data_constructors (data_constructor (prefix (constructor) (pragma) (strict_field (name)))))) (data_type (name) (data_constructors (data_constructor (prefix (constructor) (comment) (lazy_field (name)))))))) ================================================================================ pragma: before do statement ================================================================================ a = do a <- a {-# SCC "a" #-} a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (bind (variable) (variable)) (pragma) (exp (variable))))))) ================================================================================ pragma: instance method with cpp ================================================================================ instance A where #if a = a #endif {-# inline a #-} a = a -------------------------------------------------------------------------------- (haskell (declarations (instance (name) (cpp) (instance_declarations (bind (variable) (match (variable))) (cpp) (pragma))) (bind (variable) (match (variable))))) ================================================================================ pragma: indented before decl without module ================================================================================ {-# language A #-} a = a -------------------------------------------------------------------------------- (haskell (pragma) (declarations (bind (variable) (match (variable))))) ================================================================================ pragma: indented after decl ================================================================================ a = a {-# prag #-} a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))) (pragma) (bind (variable) (match (variable))))) ================================================================================ pragma: indented after module ================================================================================ module A where {-# prag #-} a = a -- This is a parse error in GHC, but since we leniently readjust top level indent -- when it decreases, it doesn't happen here. -------------------------------------------------------------------------------- (haskell (header (module (module_id))) (pragma) (declarations (bind (variable) (match (variable))) (comment))) ================================================================================ pragma: between decls ================================================================================ a = a {-# prag #-} a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))) (pragma) (bind (variable) (match (variable))))) ================================================================================ pragma: followed by inline comment ================================================================================ a = a {-# prag #-} -- a a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))) (pragma) (comment) (bind (variable) (match (variable))))) ================================================================================ pragma: followed by block comment ================================================================================ a = a {-# prag #-} {- a -} a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))) (pragma) (comment) (bind (variable) (match (variable))))) ================================================================================ pragma: after block comment ================================================================================ a = do a {- a -} {-# prag #-} a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (do (exp (variable))))) (comment) (pragma) (bind (variable) (match (variable))))) ================================================ FILE: test/corpus/prec.txt ================================================ ================================================================================ prec: infix qualified varsym with leading dot(s) ================================================================================ a = a A.!? a a = a A .!? a a = a A..!? a a = a A ..!? a a = a A...!? a a = a A ...!? a a = a A.. a a = a A..! a a = a A..= a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))) (bind (variable) (match (infix (apply (variable) (constructor)) (operator) (variable)))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))) (bind (variable) (match (infix (apply (variable) (constructor)) (operator) (variable)))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))) (bind (variable) (match (infix (apply (variable) (constructor)) (operator) (variable)))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))))) ================================================================================ prec: infix qualified consym ================================================================================ a = a A.:!? a a = a A :!? a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (variable) (qualified (module (module_id)) (constructor_operator)) (variable)))) (bind (variable) (match (infix (apply (variable) (constructor)) (constructor_operator) (variable)))))) ================================================================================ prec: varop decl with leading dot ================================================================================ (.&) :: a (.=) :: a (..&) :: a -------------------------------------------------------------------------------- (haskell (declarations (signature (prefix_id (operator)) (variable)) (signature (prefix_id (operator)) (variable)) (signature (prefix_id (operator)) (variable)))) ================================================================================ prec: varop exp with leading dot ================================================================================ a = (A..!?) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (prefix_id (qualified (module (module_id)) (operator))))))) ================================================================================ prec: varop import with leading dot ================================================================================ import A ((.=)) -------------------------------------------------------------------------------- (haskell (imports (import (module (module_id)) (import_list (import_name (prefix_id (operator))))))) ================================================================================ prec: varop export with leading dot ================================================================================ module A ((.=)) where -------------------------------------------------------------------------------- (haskell (header (module (module_id)) (exports (export (prefix_id (operator)))))) ================================================================================ prec: infix varop with leading dot in list ================================================================================ a = [a .+ a] a = [a ..+ a] a = [a A..+ a] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (list (infix (variable) (operator) (variable))))) (bind (variable) (match (list (infix (variable) (operator) (variable))))) (bind (variable) (match (list (infix (variable) (qualified (module (module_id)) (operator)) (variable))))))) ================================================================================ prec: tight infix varop with leading dot ================================================================================ a = a.+a a = a..+a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))))) ================================================================================ prec: arithmetic sequence ================================================================================ a = [1..] a = [a..] a = [1 ..] a = [a ..] a = [1..2] a = [a..a] a = [1 ..2] a = [a ..a] a = [1.. 2] a = [a.. a] a = [1 .. 2] a = [a .. a] a = [1,2..] a = [a,a..] a = [1,2 ..] a = [a,a ..] a = [1,2..3] a = [a,a..a] a = [1,2 ..3] a = [a,a ..a] a = [1,2.. 3] a = [a,a.. a] a = [1,2 .. 3] a = [a,a .. a] -- This should be an error, since a conid followed by two dots parses as the -- qualified composition operator, but we allow it since there's no way to use -- an operator here, like it would be in a section. a = [A..a] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (arithmetic_sequence (literal (integer))))) (bind (variable) (match (arithmetic_sequence (variable)))) (bind (variable) (match (arithmetic_sequence (literal (integer))))) (bind (variable) (match (arithmetic_sequence (variable)))) (bind (variable) (match (arithmetic_sequence (literal (integer)) (literal (integer))))) (bind (variable) (match (arithmetic_sequence (variable) (variable)))) (bind (variable) (match (arithmetic_sequence (literal (integer)) (literal (integer))))) (bind (variable) (match (arithmetic_sequence (variable) (variable)))) (bind (variable) (match (arithmetic_sequence (literal (integer)) (literal (integer))))) (bind (variable) (match (arithmetic_sequence (variable) (variable)))) (bind (variable) (match (arithmetic_sequence (literal (integer)) (literal (integer))))) (bind (variable) (match (arithmetic_sequence (variable) (variable)))) (bind (variable) (match (arithmetic_sequence (literal (integer)) (literal (integer))))) (bind (variable) (match (arithmetic_sequence (variable) (variable)))) (bind (variable) (match (arithmetic_sequence (literal (integer)) (literal (integer))))) (bind (variable) (match (arithmetic_sequence (variable) (variable)))) (bind (variable) (match (arithmetic_sequence (literal (integer)) (literal (integer)) (literal (integer))))) (bind (variable) (match (arithmetic_sequence (variable) (variable) (variable)))) (bind (variable) (match (arithmetic_sequence (literal (integer)) (literal (integer)) (literal (integer))))) (bind (variable) (match (arithmetic_sequence (variable) (variable) (variable)))) (bind (variable) (match (arithmetic_sequence (literal (integer)) (literal (integer)) (literal (integer))))) (bind (variable) (match (arithmetic_sequence (variable) (variable) (variable)))) (bind (variable) (match (arithmetic_sequence (literal (integer)) (literal (integer)) (literal (integer))))) (bind (variable) (match (arithmetic_sequence (variable) (variable) (variable)))) (comment) (bind (variable) (match (arithmetic_sequence (constructor) (variable)))))) ================================================================================ prec: section with leading dot ================================================================================ a = (.& a) a = (a .&) a = (. a) a = (a .) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (right_section (operator) (variable)))) (bind (variable) (match (left_section (variable) (operator)))) (bind (variable) (match (right_section (operator) (variable)))) (bind (variable) (match (left_section (variable) (operator)))))) ================================================================================ prec: composition basic ================================================================================ a = a. a a = a .a a = a . a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))))) ================================================================================ prec: composition in parens ================================================================================ -- Note: These may be parsed as sections a = (a. a) a = (a .a) a = (a . a) -------------------------------------------------------------------------------- (haskell (comment) (declarations (bind (variable) (match (parens (infix (variable) (operator) (variable))))) (bind (variable) (match (parens (infix (variable) (operator) (variable))))) (bind (variable) (match (parens (infix (variable) (operator) (variable))))))) ================================================================================ prec: composition and qualified names ================================================================================ a = A.A.a . a a = A.A.a . A.a a = A.A.a. a a = A.A.a. A.a a = A.A.a .a a = A.A.a .A.a a = A.A.A . a a = A.A.A . A.a a = A.A.A. a a = A.A.A. A.a a = A.A.A .a a = A.A.A .A.a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (qualified (module (module_id) (module_id)) (variable)) (operator) (variable)))) (bind (variable) (match (infix (qualified (module (module_id) (module_id)) (variable)) (operator) (qualified (module (module_id)) (variable))))) (bind (variable) (match (infix (qualified (module (module_id) (module_id)) (variable)) (operator) (variable)))) (bind (variable) (match (infix (qualified (module (module_id) (module_id)) (variable)) (operator) (qualified (module (module_id)) (variable))))) (bind (variable) (match (infix (qualified (module (module_id) (module_id)) (variable)) (operator) (variable)))) (bind (variable) (match (infix (qualified (module (module_id) (module_id)) (variable)) (operator) (qualified (module (module_id)) (variable))))) (bind (variable) (match (infix (qualified (module (module_id) (module_id)) (constructor)) (operator) (variable)))) (bind (variable) (match (infix (qualified (module (module_id) (module_id)) (constructor)) (operator) (qualified (module (module_id)) (variable))))) (bind (variable) (match (infix (qualified (module (module_id) (module_id)) (constructor)) (operator) (variable)))) (bind (variable) (match (infix (qualified (module (module_id) (module_id)) (constructor)) (operator) (qualified (module (module_id)) (variable))))) (bind (variable) (match (infix (qualified (module (module_id) (module_id)) (constructor)) (operator) (variable)))) (bind (variable) (match (infix (qualified (module (module_id) (module_id)) (constructor)) (operator) (qualified (module (module_id)) (variable))))))) ================================================================================ prec: composition before parens ================================================================================ a = a.(a) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (variable) (operator) (parens (variable))))))) ================================================================================ prec: if block arguments with exp annotation ================================================================================ a = a if a :: A then \ a -> a :: A else a :: A a = a if | a -> a :: A -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (conditional (signature (variable) (name)) (lambda (patterns (variable)) (signature (variable) (name))) (signature (variable) (name)))))) (bind (variable) (match (apply (variable) (multi_way_if (match (guards (boolean (variable))) (signature (variable) (name))))))))) ================================================================================ prec: block argument: apply ================================================================================ a = do \ a -> a case a of a -> a do a + a if | a -> a | a -> a * do a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (apply (apply (apply (do (exp (lambda (patterns (variable)) (variable)))) (case (variable) (alternatives (alternative (variable) (match (variable)))))) (do (exp (infix (variable) (operator) (variable))))) (multi_way_if (match (guards (boolean (variable))) (variable)) (match (guards (boolean (variable))) (variable)))) (operator) (do (exp (variable)))))))) ================================================================================ prec: greedy signature in pattern binder ================================================================================ a :: A ++ A = a -------------------------------------------------------------------------------- (haskell (declarations (bind (signature (variable) (infix (name) (operator) (name))) (match (variable))))) ================================================================================ prec: signature with subsequent function vs. pattern binder ================================================================================ a :: A a = a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (name)) (bind (variable) (match (variable))))) ================================================================================ prec: hash: signature lhs ================================================================================ (#) :: a (#!) :: a (#?) :: a -------------------------------------------------------------------------------- (haskell (declarations (signature (prefix_id (operator)) (variable)) (signature (prefix_id (operator)) (variable)) (signature (prefix_id (operator)) (variable)))) ================================================================================ prec: hash: prefix expression ================================================================================ a = (#) a = (#!) a = (#?) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (prefix_id (operator)))) (bind (variable) (match (prefix_id (operator)))) (bind (variable) (match (prefix_id (operator)))))) ================================================================================ prec: hash: right section ================================================================================ a = (# a) a = (## a) a = (#! a) a = (#? a) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (right_section (operator) (variable)))) (bind (variable) (match (right_section (operator) (variable)))) (bind (variable) (match (right_section (operator) (variable)))) (bind (variable) (match (right_section (operator) (variable)))))) ================================================================================ prec: hash: left section ================================================================================ a = (a #) a = (a # ) a = (a ##) a = (a #!) a = (a #?) a = (a !#) a = (a ?#) a = (a #|) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (left_section (variable) (operator)))) (bind (variable) (match (left_section (variable) (operator)))) (bind (variable) (match (left_section (variable) (operator)))) (bind (variable) (match (left_section (variable) (operator)))) (bind (variable) (match (left_section (variable) (operator)))) (bind (variable) (match (left_section (variable) (operator)))) (bind (variable) (match (left_section (variable) (operator)))) (bind (variable) (match (left_section (variable) (operator)))))) ================================================================================ prec: hash: unboxed expression ================================================================================ a = (# #) a = (##) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (unboxed_unit))) (bind (variable) (match (unboxed_unit))))) ================================================================================ prec: hash: infix ================================================================================ a = a#a a = a# a a = a #a a = a # a a = a ## a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (variable)))) (bind (variable) (match (apply (variable) (variable)))) (bind (variable) (match (apply (variable) (label)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))))) ================================================================================ prec: hash: prefix type ================================================================================ type (#) = (#) type (#!) = (#!) type (#?) = (#?) -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (prefix_id (operator)) (prefix_id (operator))) (type_synomym (prefix_id (operator)) (prefix_id (operator))) (type_synomym (prefix_id (operator)) (prefix_id (operator))))) ================================================================================ prec: hash: unboxed type ================================================================================ type A = (# a # b, a #) type A = (# a, a # b, c #) type A = (# a, a # b #) type A = (# A | A# #) type A = (# a # b | a #) type A = (# a | a # b | c #) -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (unboxed_tuple (infix (variable) (operator) (variable)) (variable))) (type_synomym (name) (unboxed_tuple (variable) (infix (variable) (operator) (variable)) (variable))) (type_synomym (name) (unboxed_tuple (variable) (infix (variable) (operator) (variable)))) (type_synomym (name) (unboxed_sum (name) (name))) (type_synomym (name) (unboxed_sum (infix (variable) (operator) (variable)) (variable))) (type_synomym (name) (unboxed_sum (variable) (infix (variable) (operator) (variable)) (variable))))) ================================================================================ prec: hash: edge cases ================================================================================ -- Unboxed sum opening bar without space (#|) :: a a = (#|) a = (#| a) -- Unboxed sum closing bar without space (|#) :: a a = (|#) a = (a |#) -- MagicHash decl with guard has the sequence `# |` in it a# | a = a -- Same with operator a = a# || a -------------------------------------------------------------------------------- (haskell (comment) (declarations (signature (prefix_id (operator)) (variable)) (bind (variable) (match (prefix_id (operator)))) (bind (variable) (match (right_section (operator) (variable)))) (comment) (signature (prefix_id (operator)) (variable)) (bind (variable) (match (prefix_id (operator)))) (bind (variable) (match (left_section (variable) (operator)))) (comment) (bind (variable) (match (guards (boolean (variable))) (variable))) (comment) (bind (variable) (match (infix (variable) (operator) (variable)))))) ================================================================================ prec: annotation after lambda ================================================================================ a = \ a -> a :: A -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (lambda (patterns (variable)) (signature (variable) (name))))))) ================================================================================ prec: negation in right infix operand ================================================================================ a = a $ - a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (variable) (operator) (negation (variable))))))) ================================================================================ prec: negation vs. infix with apply ================================================================================ a = a a a - a a a a = a a - a a - a a a = a a - a a + a a a = a a + a a - a a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (apply (apply (variable) (variable)) (variable)) (operator) (apply (apply (variable) (variable)) (variable))))) (bind (variable) (match (infix (apply (variable) (variable)) (operator) (infix (apply (variable) (variable)) (operator) (apply (variable) (variable)))))) (bind (variable) (match (infix (apply (variable) (variable)) (operator) (infix (apply (variable) (variable)) (operator) (apply (variable) (variable)))))) (bind (variable) (match (infix (apply (variable) (variable)) (operator) (infix (apply (variable) (variable)) (operator) (apply (variable) (variable)))))))) ================================================================================ prec: negation in left operand of infix minus ================================================================================ a = - a - a a = - a a - a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (negation (variable)) (operator) (variable)))) (bind (variable) (match (infix (negation (apply (variable) (variable))) (operator) (variable)))))) ================================================================================ prec: left minus section with minus infix ================================================================================ a = (a - a -) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (left_section (infix (variable) (operator) (variable)) (operator)))))) ================================================================================ prec: eldritch horror section ================================================================================ a = (+ - a + - a) a = (+ - a a + - a a) a = (+ - a a a + - a a a) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (right_section (operator) (infix (negation (variable)) (operator) (negation (variable)))))) (bind (variable) (match (right_section (operator) (infix (negation (apply (variable) (variable))) (operator) (negation (apply (variable) (variable))))))) (bind (variable) (match (right_section (operator) (infix (negation (apply (apply (variable) (variable)) (variable))) (operator) (negation (apply (apply (variable) (variable)) (variable))))))))) ================================================================================ prec: qualified infix varsym with two module segments ================================================================================ a = a A.A.+++ a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (variable) (qualified (module (module_id) (module_id)) (operator)) (variable)))))) ================================================================================ prec: qualified infix varsym with apply in left operand ================================================================================ -- This has the strong potential to pull the operator into the apply a = a a A.+++ a -------------------------------------------------------------------------------- (haskell (comment) (declarations (bind (variable) (match (infix (apply (variable) (variable)) (qualified (module (module_id)) (operator)) (variable)))))) ================================================================================ prec: apply in nested infix with all qualified names with two module segments ================================================================================ a = A.A.a A.A.a A.A.+++ A.A.a A.A.a A.A.+++ A.A.a A.A.a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (apply (qualified (module (module_id) (module_id)) (variable)) (qualified (module (module_id) (module_id)) (variable))) (qualified (module (module_id) (module_id)) (operator)) (infix (apply (qualified (module (module_id) (module_id)) (variable)) (qualified (module (module_id) (module_id)) (variable))) (qualified (module (module_id) (module_id)) (operator)) (apply (qualified (module (module_id) (module_id)) (variable)) (qualified (module (module_id) (module_id)) (variable))))))))) ================================================================================ prec: apply/infix/qualified in type ================================================================================ type A = A.A.A A.A.A A.A.+++ A.A.A A.A.A A.A.+++ A.A.A A.A.A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (infix (apply (qualified (module (module_id) (module_id)) (name)) (qualified (module (module_id) (module_id)) (name))) (qualified (module (module_id) (module_id)) (operator)) (infix (apply (qualified (module (module_id) (module_id)) (name)) (qualified (module (module_id) (module_id)) (name))) (qualified (module (module_id) (module_id)) (operator)) (apply (qualified (module (module_id) (module_id)) (name)) (qualified (module (module_id) (module_id)) (name)))))))) ================================================ FILE: test/corpus/signature.txt ================================================ ================================================================================ signature: forall ================================================================================ a :: forall a (a :: * -> Type) . (∀ a . a -> a) -> A a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (forall (quantified_variables (variable) (parens (annotated (variable) (function (star) (name))))) (function (parens (forall (quantified_variables (variable)) (function (variable) (variable)))) (apply (name) (variable))))))) ================================================================================ signature: alternating forall/context/arrow/infix ================================================================================ a :: A a => ∀ a. a ++ a => a -> ∀ a. a -> A => A => A a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (context (apply (name) (variable)) (forall (quantified_variables (variable)) (context (infix (variable) (operator) (variable)) (function (variable) (forall (quantified_variables (variable)) (function (variable) (context (name) (context (name) (apply (name) (variable))))))))))))) ================================================================================ signature: partial ================================================================================ a :: A -> _ -> (_, a) -> _a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (function (name) (function (wildcard) (function (tuple (wildcard) (variable)) (variable))))))) ================================================================================ signature: unicode herald ================================================================================ a ∷ a -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (variable)))) ================================================ FILE: test/corpus/special.txt ================================================ ================================================================================ special: GHC fixity decl for -> in GHC.Types ================================================================================ infixr -1 -> -------------------------------------------------------------------------------- (haskell declarations: (declarations (fixity precedence: (integer) operator: (operator)))) ================================================ FILE: test/corpus/string.txt ================================================ ================================================================================ string: special chars ================================================================================ a = "\\\"\a\b\f\n\r\t\v\&\NUL\SOH\STX\ETX\EOT\ENQ\ACK\BEL\BS\HT\LF\VT\FF\CR\SO\SI\DLE\DC1\DC2\DC3\DC4\NAK\SYN\ETB\CAN\EM\SUB\ESC\FS\GS\RS\US\SP\DEL\^A\^Z\^@\^[\^]\^\\^^\^_" -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (literal (string)))))) ================================================================================ string: gap ================================================================================ a = "start\ \" a = "start\ \end" -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (literal (string)))) (bind (variable) (match (literal (string)))))) ================================================================================ string: magic hash ================================================================================ a = "a"# a = "a"## -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (literal (string)))) (bind (variable) (match (literal (string)))))) ================================================ FILE: test/corpus/th.txt ================================================ ================================================================================ th: quasiquotes ================================================================================ f = [quoter|body|] [quoter|body|with|bars and newline|] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (quasiquote (quoter (variable)) (quasiquote_body)) (quasiquote (quoter (variable)) (quasiquote_body))))))) ================================================================================ th: top level splice with parens ================================================================================ $(a ''Aa) $(a ''A.Aa) -------------------------------------------------------------------------------- (haskell (declarations (top_splice (splice (parens (apply (variable) (th_quoted_name (name)))))) (top_splice (splice (parens (apply (variable) (th_quoted_name (qualified (module (module_id)) (name))))))))) ================================================================================ th: inline splice variable ================================================================================ f = $a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (splice (variable)))))) ================================================================================ th: inline splice parens ================================================================================ f = $(a . a $ a) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (splice (parens (infix (variable) (operator) (infix (variable) (operator) (variable))))))))) ================================================================================ th: inline typed splice ================================================================================ a = $$a a = $$(a) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (splice (variable)))) (bind (variable) (match (splice (parens (variable))))))) ================================================================================ th: inline splice in function application ================================================================================ a = a $(a) -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (splice (parens (variable)))))))) ================================================================================ th: top level splice without parens ================================================================================ derive ''Aa derive [''Aa] derive $ ''Aa derive A a @A -------------------------------------------------------------------------------- (haskell (declarations (top_splice (apply (variable) (th_quoted_name (name)))) (top_splice (apply (variable) (list (th_quoted_name (name))))) (top_splice (infix (variable) (operator) (th_quoted_name (name)))) (top_splice (apply (apply (apply (variable) (constructor)) (variable)) (type_application (name)))))) ================================================================================ th: comment in quote body ================================================================================ a = [q|-- a|] a = [q|{- a -}|] a = [|{- a -}|] a = [q| -- a a -- a |] a = [e| -- a a -- a |] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (quasiquote (quoter (variable)) (quasiquote_body)))) (bind (variable) (match (quasiquote (quoter (variable)) (quasiquote_body)))) (bind (variable) (match (quote (comment)))) (bind (variable) (match (quasiquote (quoter (variable)) (quasiquote_body)))) (bind (variable) (match (quote (comment) (quoted_expression (variable)) (comment)))))) ================================================================================ th: error: comment in expression quote body ranging over closing bracket ================================================================================ a = [t|-- a|] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (quote (comment) (MISSING "|]")))))) ================================================================================ th: qualified quoter ================================================================================ a = [A.a|a|] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (quasiquote (quoter (qualified (module (module_id)) (variable))) (quasiquote_body)))))) ================================================================================ th: error: incomplete quote ================================================================================ a = [a| -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (quasiquote (quoter (variable)) (quasiquote_body) (MISSING "|]")))))) ================================================================================ th: do block top level splice ================================================================================ do a <- a a -------------------------------------------------------------------------------- (haskell (declarations (top_splice (do (bind (variable) (variable)) (exp (variable)))))) ================================================================================ th: quoted expression ================================================================================ a = ⟦a + a⟧ a = [e|A a ++ [(A, a), "hello"]|] a = [|a + a⟧ a = [e|a + a⟧ -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (quote (quoted_expression (infix (variable) (operator) (variable)))))) (bind (variable) (match (quote (quoted_expression (infix (apply (constructor) (variable)) (operator) (list (tuple (constructor) (variable)) (literal (string)))))))) (bind (variable) (match (quote (quoted_expression (infix (variable) (operator) (variable)))))) (bind (variable) (match (quote (quoted_expression (infix (variable) (operator) (variable)))))))) ================================================================================ th: quoted type ================================================================================ a = [t|∀ a . A a => a ++ a :: A⟧ -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (quote (quoted_type (signature (forall (quantified_variables (variable)) (context (apply (name) (variable)) (infix (variable) (operator) (variable)))) (name)))))))) ================================================================================ th: quoted pattern ================================================================================ a = [p|(a -> A {a = !A})|] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (quote (quoted_pattern (parens (view_pattern (variable) (record (constructor) (field_pattern (field_name (variable)) (strict (constructor)))))))))))) ================================================================================ th: quoted decls ================================================================================ a = [d| instance A a => A a where a == a = a a :: A => a type family A a :: A |] a = [d|{ a = a ; a = a }|] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (quote (quoted_decls (instance (context (apply (name) (variable))) (name) (type_patterns (variable)) (instance_declarations (function (infix (variable) (operator) (variable)) (match (variable))))) (signature (variable) (context (name) (variable))) (type_family (name) (type_params (variable)) (name)))))) (bind (variable) (match (quote (quoted_decls (bind (variable) (match (variable))) (bind (variable) (match (variable))))))))) ================================================================================ Close nested layouts at closing bracket in decl quote ================================================================================ a = a where a = [d|instance A where a = a |] a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable)) (local_binds (bind (variable) (match (quote (quoted_decls (instance (name) (instance_declarations (bind (variable) (match (variable))))))))))) (bind (variable) (match (variable))))) ================================================================================ th: typed expression quotation ================================================================================ a = [|| a + a ||] a = [e|| a + a ||] a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (typed_quote (quoted_expression (infix (variable) (operator) (variable)))))) (bind (variable) (match (typed_quote (quoted_expression (infix (variable) (operator) (variable)))))) (bind (variable) (match (variable))))) ================================================================================ th: quoter with prime ================================================================================ a = [a'a'|a|] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (quasiquote (quoter (variable)) (quasiquote_body)))))) ================================================================================ th: expression quote as splice expression ================================================================================ -- Deliberately excluded from splice expressions to avoid parser size explosion a = a $⟦a|] -------------------------------------------------------------------------------- (haskell (comment) (declarations (bind (variable) (match (infix (variable) (operator) (quote (quoted_expression (variable)))))))) ================================================================================ th: nested splice in type ================================================================================ a :: A -> $(a :: A -> $(a :: A)) -------------------------------------------------------------------------------- (haskell (declarations (signature (variable) (function (name) (splice (parens (signature (variable) (function (name) (splice (parens (signature (variable) (name)))))))))))) ================================================================================ th: quasiquote escape ================================================================================ a = [a|a\|] -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (quasiquote (quoter (variable)) (quasiquote_body)))))) ================================================================================ th: top-level expression splice with negation ================================================================================ -5 -------------------------------------------------------------------------------- (haskell (declarations (top_splice (negation (literal (integer)))))) ================================================ FILE: test/corpus/type.txt ================================================ ================================================================================ type: basic ================================================================================ type A = A type A a = A a a A a type A = A A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (name)) (type_synomym (name) (type_params (variable)) (apply (apply (apply (apply (name) (variable)) (variable)) (name)) (variable))) (type_synomym (name) (apply (name) (name))))) ================================================================================ type: two tycons ================================================================================ type A = A A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (apply (name) (name))))) ================================================================================ type: promoted constructor ================================================================================ type A = ' A type A = 'A type A = 'A.A type A = 'A.A.A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (promoted (constructor))) (type_synomym (name) (promoted (constructor))) (type_synomym (name) (promoted (qualified (module (module_id)) (constructor)))) (type_synomym (name) (promoted (qualified (module (module_id) (module_id)) (constructor)))))) ================================================================================ type: list plain ================================================================================ type A = [] type A = [A a] -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (prefix_list)) (type_synomym (name) (list (apply (name) (variable)))))) ================================================================================ type: parens ================================================================================ type A = () type A = (,) type A = (,,) type A = (->) type A = (A.A.->) -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (unit)) (type_synomym (name) (prefix_tuple)) (type_synomym (name) (prefix_tuple)) (type_synomym (name) (prefix_id (operator))) (type_synomym (name) (prefix_id (qualified (module (module_id) (module_id)) (operator)))))) ================================================================================ type: varsym ================================================================================ type A = A ++ A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (infix (name) (operator) (name))))) ================================================================================ type: consym ================================================================================ type A = A :++ A ':++ A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (infix (name) (constructor_operator) (infix (name) (promoted (constructor_operator)) (name)))))) ================================================================================ type: list cons ================================================================================ type A = A : A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (infix (name) (constructor_operator) (name))))) ================================================================================ type: promoted list cons ================================================================================ type A = A ': A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (infix (name) (promoted (constructor_operator)) (name))))) ================================================================================ type: promoted list nil ================================================================================ type A = '[] -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (promoted (empty_list))))) ================================================================================ type: list literal ================================================================================ type A = [A a, 'A, a] -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (list (apply (name) (variable)) (promoted (constructor)) (variable))))) ================================================================================ type: promoted list literal ================================================================================ type A = ' [A a, 'A, a] type A = '[a] -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (promoted (list (apply (name) (variable)) (promoted (constructor)) (variable)))) (type_synomym (name) (promoted (list (variable)))))) ================================================================================ type: qualified consym ================================================================================ type A = A A.A.:++ A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (infix (name) (qualified (module (module_id) (module_id)) (constructor_operator)) (name))))) ================================================================================ type: promoted consym ================================================================================ type A = A ':++ A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (infix (name) (promoted (constructor_operator)) (name))))) ================================================================================ type: qualified promoted consym ================================================================================ type A = A 'A.:++ A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (infix (name) (promoted (qualified (module (module_id)) (constructor_operator))) (name))))) ================================================================================ type: qualified ticked ================================================================================ type A = A `A.A` A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (infix (name) (infix_id (qualified (module (module_id)) (name))) (name))))) ================================================================================ type: promoted tuple ================================================================================ type A = '(A a, A) -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (promoted (tuple (apply (name) (variable)) (name)))))) ================================================================================ type: promoted prefix tuple ================================================================================ type A = '(,,,) -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (promoted (prefix_tuple))))) ================================================================================ type: equality ================================================================================ type A = A ~ A type A = A ~~ A type A = ∀ a . (A a ~ A a) => A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (infix (name) (operator) (name))) (type_synomym (name) (infix (name) (operator) (name))) (type_synomym (name) (forall (quantified_variables (variable)) (context (parens (infix (apply (name) (variable)) (operator) (apply (name) (variable)))) (name)))))) ================================================================================ type: infix promoted consym after apply ================================================================================ type A = a a ': a -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (infix (apply (variable) (variable)) (promoted (constructor_operator)) (variable))))) ================================================================================ type: mixed infix ================================================================================ type A = A :++ A A ': A (A A a) : '[] ':++ A `A.A` '[] -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (infix (name) (constructor_operator) (infix (apply (name) (name)) (promoted (constructor_operator)) (infix (apply (name) (parens (apply (apply (name) (name)) (variable)))) (constructor_operator) (infix (promoted (empty_list)) (promoted (constructor_operator)) (infix (name) (infix_id (qualified (module (module_id)) (name))) (promoted (empty_list)))))))))) ================================================================================ type: multi-apply in infix ================================================================================ type A = A a a a ++ A a a a -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (infix (apply (apply (apply (name) (variable)) (variable)) (variable)) (operator) (apply (apply (apply (name) (variable)) (variable)) (variable)))))) ================================================================================ type: symbol ================================================================================ type A = "a" type A = A (A "a") -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (literal (string))) (type_synomym (name) (apply (name) (parens (apply (name) (literal (string)))))))) ================================================================================ type: prefix notation symbol ================================================================================ type A = (++) a a -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (apply (apply (prefix_id (operator)) (variable)) (variable))))) ================================================================================ type: nullary context ================================================================================ type A = A => A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (context (name) (name))))) ================================================================================ type: forall only ================================================================================ type A = ∀ a . A a -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (forall (quantified_variables (variable)) (apply (name) (variable)))))) ================================================================================ type: forall context ================================================================================ type A = ∀ a a . A => A type A = forall a a . A a => [A] -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (forall (quantified_variables (variable) (variable)) (context (name) (name)))) (type_synomym (name) (forall (quantified_variables (variable) (variable)) (context (apply (name) (variable)) (list (name))))))) ================================================================================ type: lhs parens ================================================================================ type (A a a) = A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (parens (name) (type_params (variable) (variable))) (name)))) ================================================================================ type: role ================================================================================ type role A phantom type role A.A _ representational nominal _ phantom _ type role (A.>>) nominal nominal -------------------------------------------------------------------------------- (haskell (declarations (role_annotation (name) (type_role)) (role_annotation (qualified (module (module_id)) (name)) (type_role) (type_role) (type_role) (type_role) (type_role) (type_role)) (role_annotation (prefix_id (qualified (module (module_id)) (operator))) (type_role) (type_role)))) ================================================================================ type: kind signature ================================================================================ type A a :: a -> Type -------------------------------------------------------------------------------- (haskell (declarations (kind_signature (name) (type_params (variable)) (function (variable) (name))))) ================================================================================ type: function with multiplicity modifier ================================================================================ type A = a %1-> a type A = a %1 -> a type A = a %One -> a type A = a %m -> a -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (linear_function (variable) (modifier (literal (integer))) (variable))) (type_synomym (name) (linear_function (variable) (modifier (literal (integer))) (variable))) (type_synomym (name) (linear_function (variable) (modifier (name)) (variable))) (type_synomym (name) (linear_function (variable) (modifier (variable)) (variable))))) ================================================================================ type: special linear arrows ================================================================================ type A = A ->. A type A = A ⊸ A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (linear_function (name) (name))) (type_synomym (name) (linear_function (name) (name))))) ================================================================================ type: unboxed nullary tuple ================================================================================ type A = (# #) type A = (##) -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (unboxed_unit)) (type_synomym (name) (unboxed_unit)))) ================================================================================ type: unboxed unary tuple ================================================================================ type A = (# a #) -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (unboxed_tuple (variable))))) ================================================================================ type: unboxed tuple with newline after opening brace ================================================================================ type A = (# a #) -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (unboxed_tuple (variable))))) ================================================================================ type: unboxed tuple with newline before closing brace ================================================================================ type A = (# a #) -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (unboxed_tuple (variable))))) ================================================================================ type: unboxed sum ================================================================================ type A = (# A | A# #) -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (unboxed_sum (name) (name))))) ================================================================================ type: prefix notation unboxed tuple ================================================================================ type A = (# ,,, #) @A @A A# A# -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (apply (apply (apply (apply (prefix_unboxed_tuple) (kind_application (name))) (kind_application (name))) (name)) (name))))) ================================================================================ type: prefix notation unboxed sum ================================================================================ type A = (# | #) @A @A A# A# type A = (# | | | #) @A @A A# A# -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (apply (apply (apply (apply (prefix_unboxed_sum) (kind_application (name))) (kind_application (name))) (name)) (name))) (type_synomym (name) (apply (apply (apply (apply (prefix_unboxed_sum) (kind_application (name))) (kind_application (name))) (name)) (name))))) ================================================================================ type: unicode arrows ================================================================================ type A = A ⇒ a → a -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (context (name) (function (variable) (variable)))))) ================================================================================ type: unicode star ================================================================================ type A = ★ -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (star)))) ================================================================================ type: kind application ================================================================================ type A = A @A @A A type A = A @A A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (apply (apply (apply (name) (kind_application (name))) (kind_application (name))) (name))) (type_synomym (name) (apply (apply (name) (kind_application (name))) (name))))) ================================================================================ type: kind signature in nested type ================================================================================ type A = (∀ a . A (a :: A) => a :: A, A) -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (tuple (signature (forall (quantified_variables (variable)) (context (apply (name) (parens (signature (variable) (name)))) (variable))) (name)) (name))))) ================================================================================ type: inferred binder at column 0 ================================================================================ type A :: ∀ { a } . a -------------------------------------------------------------------------------- (haskell (declarations (kind_signature (name) (forall (quantified_variables (inferred (variable))) (variable))))) ================================================================================ type: double signature ================================================================================ type A = (A :: A) :: A -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (signature (parens (signature (name) (name))) (name))))) ================================================================================ type: HKT annotation ================================================================================ type A = (a :: (* -> *) -> *) -> a -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (function (parens (signature (variable) (function (parens (function (star) (star))) (star)))) (variable))))) ================================================================================ type: splice ================================================================================ type A = a -> $(a ''A) -> a -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (function (variable) (function (splice (parens (apply (variable) (th_quoted_name (name))))) (variable)))))) ================================================================================ type: quasiquote ================================================================================ type A = a -> [a|a|] -> a -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (function (variable) (function (quasiquote (quoter (variable)) (quasiquote_body)) (variable)))))) ================================================================================ type: inferred type variable ================================================================================ type A = ∀ {a} {a :: A} a . a -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (forall (quantified_variables (inferred (variable)) (inferred (annotated (variable) (name))) (variable)) (variable))))) ================================================================================ type: required type arguments ================================================================================ type A = ∀ a (a :: A) {a :: A} -> forall a -> forall a . a -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (forall_required (quantified_variables (variable) (parens (annotated (variable) (name))) (inferred (annotated (variable) (name)))) (forall_required (quantified_variables (variable)) (forall (quantified_variables (variable)) (variable))))))) ================================================================================ type: forall without variables ================================================================================ type A = ∀ . a type A = ∀ -> a -------------------------------------------------------------------------------- (haskell (declarations (type_synomym (name) (forall (variable))) (type_synomym (name) (forall_required (variable))))) ================================================ FILE: test/corpus/varsym.txt ================================================ ================================================================================ varsym: error: | ================================================================================ f = a | a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable)))) (ERROR (variable))) ================================================================================ varsym: error: lambda ================================================================================ f = a \\ a f = a \ a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (variable))) (ERROR (variable)))) ================================================================================ varsym: error: .. ================================================================================ f = a .. a f = a ... a f = a . a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (ERROR) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))))) ================================================================================ varsym: error: arrow ================================================================================ f = a -> a f = a |> a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (ERROR) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))))) ================================================================================ varsym: error: carrow ================================================================================ f = a => a f = a =>> a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (ERROR (UNEXPECTED '>')) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))))) ================================================================================ varsym: error: larrow ================================================================================ f = a < a f = a <- a f = a <-- a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (apply (variable) (ERROR) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))))) ================================================================================ varsym: error: @ ================================================================================ f = a @ a f = a @@ a f = a @! a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))))) ================================================================================ varsym: error: equals ================================================================================ a = a = a a = a == a a == a a a a == a a =>> a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (apply (variable) (ERROR) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (top_splice (infix (variable) (operator) (variable))) (top_splice (infix (apply (apply (variable) (variable)) (variable)) (operator) (variable))) (top_splice (infix (variable) (operator) (variable))))) ================================================================================ varsym: error: leading : ================================================================================ f = a :+ a f = a +: a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (variable) (constructor_operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))))) ================================================================================ varsym: comment with more than two dashes ================================================================================ a = a --- a a = a ----- a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (variable))) (comment) (bind (variable) (match (variable))) (comment))) ================================================================================ varsym: operator with large number of dashes ================================================================================ a = a ------> a ----- % -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (infix (variable) (operator) (variable)))) (comment))) ================================================================================ varsym: implicit parameter ================================================================================ a = ?a (?) = a a = a ? a -------------------------------------------------------------------------------- (haskell (declarations (bind (variable) (match (implicit_variable))) (bind (prefix_id (operator)) (match (variable))) (bind (variable) (match (infix (variable) (operator) (variable)))))) ================================================================================ varsym: dollar terminated by opening bracket ================================================================================ -- Deliberately excluded from splice expressions to avoid parser size explosion a = a $[a] -------------------------------------------------------------------------------- (haskell (comment) (declarations (bind (variable) (match (infix (variable) (operator) (list (variable))))))) ================================================================================ varsym: unicode symbol ================================================================================ (▽/▽) = a -------------------------------------------------------------------------------- (haskell (declarations (bind (prefix_id (operator)) (match (variable))))) ================================================================================ varsym: single-char operator: bang ================================================================================ (!) = (!) a = a!a a = a! a a = a !a a = a ! a a = (a ! a) a = a A.! a a = a !! a a = (a !! a) a ! a = a -------------------------------------------------------------------------------- (haskell (declarations (bind (prefix_id (operator)) (match (prefix_id (operator)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (parens (infix (variable) (operator) (variable))))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (parens (infix (variable) (operator) (variable))))) (function (infix (variable) (operator) (variable)) (match (variable))))) ================================================================================ varsym: single-char operator: hash ================================================================================ (#) = (#) a = a#a a = a# a a = a #a a = a # a a = (a # a) a = a A.# a -------------------------------------------------------------------------------- (haskell (declarations (bind (prefix_id (operator)) (match (prefix_id (operator)))) (bind (variable) (match (apply (variable) (variable)))) (bind (variable) (match (apply (variable) (variable)))) (bind (variable) (match (apply (variable) (label)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (parens (infix (variable) (operator) (variable))))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))))) ================================================================================ varsym: single-char operator: dollar ================================================================================ ($) = ($) -- This turned wrong after moving dollar parsing out of the scanner, but it probably doesn't matter much. a = a$a a = a$ a a = a $a a = a $ a a = a $$ a a = a $$$ a a = (a $ a) a = a A.$ a -------------------------------------------------------------------------------- (haskell (declarations (bind (prefix_id (operator)) (match (prefix_id (operator)))) (comment) (bind (variable) (match (apply (variable) (splice (variable))))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (apply (variable) (splice (variable))))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (parens (infix (variable) (operator) (variable))))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))))) ================================================================================ varsym: single-char operator: percent ================================================================================ (%) = (%) a = a%a a = a% a a = a %a a = a % a a = (a % a) a = a A.% a type A = a % a -------------------------------------------------------------------------------- (haskell (declarations (bind (prefix_id (operator)) (match (prefix_id (operator)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (parens (infix (variable) (operator) (variable))))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))) (type_synomym (name) (infix (variable) (operator) (variable))))) ================================================================================ varsym: single-char operator: ampersand ================================================================================ (&) = (&) a = a&a a = a& a a = a &a a = a & a a = (a & a) a = a A.& a -------------------------------------------------------------------------------- (haskell (declarations (bind (prefix_id (operator)) (match (prefix_id (operator)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (parens (infix (variable) (operator) (variable))))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))))) ================================================================================ varsym: single-char operator: star ================================================================================ (⋆) = (⋆) a = a⋆a a = a⋆ a a = a ⋆a a = a ⋆ a a = (a ⋆ a) a = a A.⋆ a -------------------------------------------------------------------------------- (haskell (declarations (bind (prefix_id (operator)) (match (prefix_id (operator)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (parens (infix (variable) (operator) (variable))))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))))) ================================================================================ varsym: single-char operator: asterisk ================================================================================ (*) = (*) a = a*a a = a* a a = a *a a = a * a a = (a * a) a = a A.* a type A = * -> * type A = (* -> *) type A = A * A a = (a *) -------------------------------------------------------------------------------- (haskell (declarations (bind (prefix_id (operator)) (match (prefix_id (operator)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (parens (infix (variable) (operator) (variable))))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))) (type_synomym (name) (function (star) (star))) (type_synomym (name) (parens (function (star) (star)))) (type_synomym (name) (infix (name) (operator) (name))) (bind (variable) (match (left_section (variable) (operator)))))) ================================================================================ varsym: single-char operator: plus ================================================================================ (+) = (+) a = a+a a = a+ a a = a +a a = a + a a = a A.+ a a = (a + a) -------------------------------------------------------------------------------- (haskell (declarations (bind (prefix_id (operator)) (match (prefix_id (operator)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))) (bind (variable) (match (parens (infix (variable) (operator) (variable))))))) ================================================================================ varsym: single-char operator: dot ================================================================================ (.) = (.) a = a.a a = a. a a = a .a a = a . a a = (a . a) a = a A.. a -------------------------------------------------------------------------------- (haskell (declarations (bind (prefix_id (operator)) (match (prefix_id (operator)))) (bind (variable) (match (projection (variable) (field_name (variable))))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (parens (infix (variable) (operator) (variable))))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))))) ================================================================================ varsym: single-char operator: slash ================================================================================ (/) = (/) a = a/a a = a/ a a = a /a a = a / a a = (a / a) a = a A./ a -------------------------------------------------------------------------------- (haskell (declarations (bind (prefix_id (operator)) (match (prefix_id (operator)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (parens (infix (variable) (operator) (variable))))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))))) ================================================================================ varsym: single-char operator: left angle ================================================================================ (<) = (<) a = a) = (>) a = a>a a = a> a a = a >a a = a > a a = (a > a) a = a A.> a -------------------------------------------------------------------------------- (haskell (declarations (bind (prefix_id (operator)) (match (prefix_id (operator)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (parens (infix (variable) (operator) (variable))))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))))) ================================================================================ varsym: single-char operator: question mark ================================================================================ (?) = (?) -- This is correct a = a?a a = a? a a = a ?a a = a ? a a = (a ? a) a = a A.? a -------------------------------------------------------------------------------- (haskell (declarations (bind (prefix_id (operator)) (match (prefix_id (operator)))) (comment) (bind (variable) (match (apply (variable) (implicit_variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (apply (variable) (implicit_variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (parens (infix (variable) (operator) (variable))))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))))) ================================================================================ varsym: single-char operator: circumflex ================================================================================ (^) = (^) a = a^a a = a^ a a = a ^a a = a ^ a a = (a ^ a) a = a A.^ a -------------------------------------------------------------------------------- (haskell (declarations (bind (prefix_id (operator)) (match (prefix_id (operator)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (parens (infix (variable) (operator) (variable))))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))))) ================================================================================ varsym: single-char operator: minus ================================================================================ (-) = (-) a = a-a a = a- a -- This is correct – absence of whitespace doesn't change the interpretation to negation. a = a -a a = a - a a = (a - a) a = a A.- a a = (-a) a = (- a) a = (a -) a = -a a = -(a) a = (+++ - a) a - a = a type A = a - 1 -------------------------------------------------------------------------------- (haskell (declarations (bind (prefix_id (operator)) (match (prefix_id (operator)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (comment) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (parens (infix (variable) (operator) (variable))))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))) (bind (variable) (match (parens (negation (variable))))) (bind (variable) (match (parens (negation (variable))))) (bind (variable) (match (left_section (variable) (operator)))) (bind (variable) (match (negation (variable)))) (bind (variable) (match (negation (parens (variable))))) (bind (variable) (match (right_section (operator) (negation (variable))))) (function (infix (variable) (operator) (variable)) (match (variable))) (type_synomym (name) (infix (variable) (operator) (literal (integer)))))) ================================================================================ varsym: single-char operator: tilde ================================================================================ (~) = (~) a = a~a a = a~ a a = a ~a a = a ~ a a = (a ~ a) a = a A.~ a a = a ~~ a a = (a ~~ a) -------------------------------------------------------------------------------- (haskell (declarations (bind (prefix_id (operator)) (match (prefix_id (operator)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (parens (infix (variable) (operator) (variable))))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (operator)) (variable)))) (bind (variable) (match (infix (variable) (operator) (variable)))) (bind (variable) (match (parens (infix (variable) (operator) (variable))))))) ================================================================================ varsym: single-char operator: colon ================================================================================ (:) = (:) a = a:a a = a: a a = a :a a = a : a a = (a : a) a = a A.: a -------------------------------------------------------------------------------- (haskell (declarations (bind (prefix_id (constructor_operator)) (match (prefix_id (constructor_operator)))) (bind (variable) (match (infix (variable) (constructor_operator) (variable)))) (bind (variable) (match (infix (variable) (constructor_operator) (variable)))) (bind (variable) (match (infix (variable) (constructor_operator) (variable)))) (bind (variable) (match (infix (variable) (constructor_operator) (variable)))) (bind (variable) (match (parens (infix (variable) (constructor_operator) (variable))))) (bind (variable) (match (infix (variable) (qualified (module (module_id)) (constructor_operator)) (variable)))))) ================================================================================ varsym: operators with bar ================================================================================ a |> a = a -------------------------------------------------------------------------------- (haskell (declarations (function (infix (variable) (operator) (variable)) (match (variable))))) ================================================================================ varsym: operators with dollar ================================================================================ a $! a = a a = a $! a -------------------------------------------------------------------------------- (haskell (declarations (function (infix (variable) (operator) (variable)) (match (variable))) (bind (variable) (match (infix (variable) (operator) (variable)))))) ================================================ FILE: tree-sitter.json ================================================ { "grammars": [ { "name": "haskell", "camelcase": "Haskell", "scope": "source.haskell", "path": ".", "file-types": [ "hs", "hs-boot" ], "highlights": "queries/highlights.scm", "injection-regex": "^(hs|haskell)$" } ], "metadata": { "version": "0.23.1", "license": "MIT", "description": "Haskell grammar for tree-sitter", "authors": [ { "name": "Rick Winfrey" }, { "name": "Max Brunsfeld", "email": "maxbrunsfeld@gmail.com" }, { "name": "Owen Shepherd" }, { "name": "Torsten Schmits" } ], "links": { "repository": "https://github.com/tree-sitter/tree-sitter-haskell" } }, "bindings": { "c": true, "go": true, "node": true, "python": true, "rust": true, "swift": true } }