@apple/tree-sitter-pkl 0.16.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +46 -0
- package/.gitattributes +50 -0
- package/CHANGELOG.adoc +88 -0
- package/CMakeLists.txt +66 -0
- package/Cargo.lock +21 -21
- package/Cargo.toml +1 -1
- package/Makefile +97 -0
- package/Package.swift +24 -0
- package/README.md +40 -0
- package/bindings/c/tree-sitter-pkl.h +16 -0
- package/bindings/c/tree-sitter-pkl.pc.in +10 -0
- package/bindings/c/tree_sitter/tree-sitter-pkl.h +16 -0
- package/bindings/go/binding.go +15 -0
- package/bindings/go/binding_test.go +15 -0
- package/bindings/node/binding_test.js +9 -0
- package/bindings/node/index.d.ts +27 -0
- package/bindings/python/tests/test_binding.py +12 -0
- package/bindings/python/tree_sitter_pkl/__init__.py +42 -0
- package/bindings/python/tree_sitter_pkl/__init__.pyi +10 -0
- package/bindings/python/tree_sitter_pkl/binding.c +35 -0
- package/bindings/python/tree_sitter_pkl/py.typed +0 -0
- package/bindings/swift/TreeSitterPkl/pkl.h +16 -0
- package/bindings/swift/TreeSitterPklTests/TreeSitterPklTests.swift +12 -0
- package/go.mod +5 -0
- package/gradle.properties +5 -0
- package/gradlew +251 -0
- package/gradlew.bat +94 -0
- package/grammar.js +322 -208
- package/licenserc.toml +23 -0
- package/package.json +4 -4
- package/pyproject.toml +29 -0
- package/queries/highlights.scm +14 -24
- package/queries/injections.scm +4 -4
- package/queries/locals.scm +2 -2
- package/scripts/license-header.txt +13 -0
- package/setup.py +77 -0
- package/src/grammar.json +1495 -1041
- package/src/node-types.json +4261 -1172
- package/src/parser.c +41920 -50720
- package/src/scanner.c +97 -29
- package/src/tree_sitter/alloc.h +54 -0
- package/src/tree_sitter/array.h +291 -0
- package/src/tree_sitter/parser.h +80 -17
- package/test/corpus/basic/annotation.txt +241 -0
- package/test/corpus/basic/comments.txt +41 -0
- package/test/corpus/basic/shebangComment.txt +15 -0
- package/test/corpus/basic/types.txt +187 -0
- package/test/corpus/class/constModifier.txt +23 -0
- package/test/corpus/class/fixedModifier.txt +23 -0
- package/test/corpus/expr/binary.txt +107 -0
- package/test/corpus/expr/binary2.txt +18 -0
- package/test/corpus/expr/functionLiteral.txt +22 -0
- package/test/corpus/expr/if.txt +15 -0
- package/test/corpus/expr/import.txt +20 -0
- package/test/corpus/expr/let.txt +17 -0
- package/test/corpus/expr/new.txt +34 -0
- package/test/corpus/expr/qualifiedAccess.txt +102 -0
- package/test/corpus/expr/read.txt +26 -0
- package/test/corpus/expr/subscript.txt +48 -0
- package/test/corpus/expr/super.txt +27 -0
- package/test/corpus/expr/throw.txt +13 -0
- package/test/corpus/expr/trace.txt +13 -0
- package/test/corpus/expr/typeTest.txt +29 -0
- package/test/corpus/expr/unaryMinus.txt +22 -0
- package/test/corpus/module/moduleHeader1.txt +23 -0
- package/test/corpus/module/moduleHeader2.txt +29 -0
- package/test/corpus/module/moduleHeader3.error.txt +23 -0
- package/test/corpus/module/moduleHeader4.txt +34 -0
- package/test/corpus/module/moduleHeader5.txt +16 -0
- package/test/corpus/module/moduleHeader6.txt +17 -0
- package/test/corpus/number/underscores.txt +99 -0
- package/test/corpus/object/mixedEntriesAndElements.txt +52 -0
- package/test/corpus/object/objectAmendChain.txt +38 -0
- package/test/corpus/object/objectBodyParams.txt +21 -0
- package/test/corpus/object/objectElementWithTypeConstraint +30 -0
- package/test/corpus/object/objectElementsWithParens.txt +51 -0
- package/test/corpus/object/objectElementsWithTypeParams +65 -0
- package/test/corpus/object/objectGenerator.txt +53 -0
- package/test/corpus/object/objectMember.txt +129 -0
- package/test/corpus/object/objectMemberPredicate.txt +41 -0
- package/test/corpus/object/objectSpread.txt +51 -0
- package/test/corpus/object/objectWhenGenerator.txt +71 -0
- package/test/corpus/snippetTests/annotation/annotation1.txt +284 -0
- package/test/corpus/snippetTests/annotation/annotation2.txt +20 -0
- package/test/corpus/snippetTests/annotation/annotation3.txt +24 -0
- package/test/corpus/snippetTests/annotation/annotation4.txt +32 -0
- package/test/corpus/snippetTests/annotation/annotation5.txt +28 -0
- package/test/corpus/snippetTests/annotation/annotation6.txt +19 -0
- package/test/corpus/snippetTests/annotation/annotationIsNotExpression.txt +29 -0
- package/test/corpus/snippetTests/annotation/deprecated1.txt +385 -0
- package/test/corpus/snippetTests/annotation/deprecated2.txt +99 -0
- package/test/corpus/snippetTests/annotation/deprecated3.txt +155 -0
- package/test/corpus/snippetTests/annotation/deprecatedNoRepeatedWarnings.txt +58 -0
- package/test/corpus/snippetTests/annotation/deprecatedWithMessage1.txt +405 -0
- package/test/corpus/snippetTests/annotation/deprecatedWithMessage2.txt +104 -0
- package/test/corpus/snippetTests/annotation/deprecatedWithMessage3.txt +155 -0
- package/test/corpus/snippetTests/annotation/deprecationSuperMethod.txt +144 -0
- package/test/corpus/snippetTests/api/Resource.txt +128 -0
- package/test/corpus/snippetTests/api/analyze1.txt +176 -0
- package/test/corpus/snippetTests/api/any.txt +523 -0
- package/test/corpus/snippetTests/api/anyConverter.txt +161 -0
- package/test/corpus/snippetTests/api/baseModule.txt +170 -0
- package/test/corpus/snippetTests/api/dataSize.txt +1165 -0
- package/test/corpus/snippetTests/api/duration.txt +800 -0
- package/test/corpus/snippetTests/api/float.txt +1334 -0
- package/test/corpus/snippetTests/api/int.txt +1142 -0
- package/test/corpus/snippetTests/api/intseq.txt +1021 -0
- package/test/corpus/snippetTests/api/jsonParser1.txt +279 -0
- package/test/corpus/snippetTests/api/jsonParser2.txt +294 -0
- package/test/corpus/snippetTests/api/jsonParser3.txt +143 -0
- package/test/corpus/snippetTests/api/jsonParser4.txt +112 -0
- package/test/corpus/snippetTests/api/jsonParser5.txt +171 -0
- package/test/corpus/snippetTests/api/jsonRenderer1.json.txt +41 -0
- package/test/corpus/snippetTests/api/jsonRenderer2b.txt +300 -0
- package/test/corpus/snippetTests/api/jsonRenderer3.json.txt +334 -0
- package/test/corpus/snippetTests/api/jsonRenderer4.txt +388 -0
- package/test/corpus/snippetTests/api/jsonRenderer5.txt +388 -0
- package/test/corpus/snippetTests/api/jsonRenderer6.json.txt +163 -0
- package/test/corpus/snippetTests/api/jsonRenderer7.txt +53 -0
- package/test/corpus/snippetTests/api/jsonRenderer8.txt +30 -0
- package/test/corpus/snippetTests/api/jsonRendererEmptyComposites.txt +114 -0
- package/test/corpus/snippetTests/api/jsonnetRenderer3.jsonnet.txt +356 -0
- package/test/corpus/snippetTests/api/jsonnetRenderer4.txt +393 -0
- package/test/corpus/snippetTests/api/jsonnetRenderer5.txt +393 -0
- package/test/corpus/snippetTests/api/jsonnetRenderer6.jsonnet.txt +169 -0
- package/test/corpus/snippetTests/api/jsonnetRenderer7.txt +36 -0
- package/test/corpus/snippetTests/api/list.txt +4432 -0
- package/test/corpus/snippetTests/api/listNullable.txt +1513 -0
- package/test/corpus/snippetTests/api/map.txt +1144 -0
- package/test/corpus/snippetTests/api/mapping.txt +948 -0
- package/test/corpus/snippetTests/api/mathModule.txt +1426 -0
- package/test/corpus/snippetTests/api/module.txt +77 -0
- package/test/corpus/snippetTests/api/moduleOutput.txt +24 -0
- package/test/corpus/snippetTests/api/moduleOutput2.txt +25 -0
- package/test/corpus/snippetTests/api/pListRenderer1.plist.txt +41 -0
- package/test/corpus/snippetTests/api/pListRenderer3.plist.txt +348 -0
- package/test/corpus/snippetTests/api/pListRenderer4.txt +375 -0
- package/test/corpus/snippetTests/api/pListRenderer5.txt +424 -0
- package/test/corpus/snippetTests/api/pListRenderer6.plist.txt +163 -0
- package/test/corpus/snippetTests/api/pListRenderer7.txt +30 -0
- package/test/corpus/snippetTests/api/pair.txt +170 -0
- package/test/corpus/snippetTests/api/pcfRenderer1.txt +95 -0
- package/test/corpus/snippetTests/api/pcfRenderer2b.txt +301 -0
- package/test/corpus/snippetTests/api/pcfRenderer3.txt +350 -0
- package/test/corpus/snippetTests/api/pcfRenderer4.txt +391 -0
- package/test/corpus/snippetTests/api/pcfRenderer5.txt +460 -0
- package/test/corpus/snippetTests/api/pcfRenderer6.txt +118 -0
- package/test/corpus/snippetTests/api/pcfRenderer8.txt +16 -0
- package/test/corpus/snippetTests/api/platformModule.txt +147 -0
- package/test/corpus/snippetTests/api/plistRenderer2b.txt +300 -0
- package/test/corpus/snippetTests/api/propertiesRenderer1.properties.txt +41 -0
- package/test/corpus/snippetTests/api/propertiesRenderer10.properties.txt +24 -0
- package/test/corpus/snippetTests/api/propertiesRenderer11.txt +30 -0
- package/test/corpus/snippetTests/api/propertiesRenderer2b.txt +303 -0
- package/test/corpus/snippetTests/api/propertiesRenderer4.txt +484 -0
- package/test/corpus/snippetTests/api/propertiesRenderer5.txt +491 -0
- package/test/corpus/snippetTests/api/propertiesRenderer8.properties.txt +628 -0
- package/test/corpus/snippetTests/api/propertiesRenderer9.properties.txt +292 -0
- package/test/corpus/snippetTests/api/propertiesRendererBug66849708.properties.txt +106 -0
- package/test/corpus/snippetTests/api/protobuf2.txt +408 -0
- package/test/corpus/snippetTests/api/reflect1.txt +1686 -0
- package/test/corpus/snippetTests/api/reflect2.txt +480 -0
- package/test/corpus/snippetTests/api/reflect3.txt +193 -0
- package/test/corpus/snippetTests/api/reflectedDeclaration.txt +64 -0
- package/test/corpus/snippetTests/api/regex.txt +320 -0
- package/test/corpus/snippetTests/api/releaseModule.txt +262 -0
- package/test/corpus/snippetTests/api/renderDirective2.txt +374 -0
- package/test/corpus/snippetTests/api/semverModule.txt +2224 -0
- package/test/corpus/snippetTests/api/set.txt +3891 -0
- package/test/corpus/snippetTests/api/setNullable.txt +1113 -0
- package/test/corpus/snippetTests/api/typeAliases.txt +449 -0
- package/test/corpus/snippetTests/api/typeConverters.txt +211 -0
- package/test/corpus/snippetTests/api/xmlRenderer1.xml.txt +174 -0
- package/test/corpus/snippetTests/api/xmlRenderer2b.txt +306 -0
- package/test/corpus/snippetTests/api/xmlRenderer3.xml.txt +320 -0
- package/test/corpus/snippetTests/api/xmlRenderer4.txt +401 -0
- package/test/corpus/snippetTests/api/xmlRenderer5.txt +402 -0
- package/test/corpus/snippetTests/api/xmlRenderer6.xml.txt +169 -0
- package/test/corpus/snippetTests/api/xmlRenderer8.txt +36 -0
- package/test/corpus/snippetTests/api/xmlRendererCData.xml.txt +48 -0
- package/test/corpus/snippetTests/api/xmlRendererElement.xml.txt +103 -0
- package/test/corpus/snippetTests/api/xmlRendererHtml.xml.txt +212 -0
- package/test/corpus/snippetTests/api/xmlRendererInline.xml.txt +175 -0
- package/test/corpus/snippetTests/api/xmlRendererInline3.xml.txt +152 -0
- package/test/corpus/snippetTests/api/yamlParser1Yaml11.txt +22 -0
- package/test/corpus/snippetTests/api/yamlParser1Yaml12.txt +22 -0
- package/test/corpus/snippetTests/api/yamlParser2.txt +253 -0
- package/test/corpus/snippetTests/api/yamlParser3.txt +194 -0
- package/test/corpus/snippetTests/api/yamlParser4.txt +198 -0
- package/test/corpus/snippetTests/api/yamlParser5.txt +86 -0
- package/test/corpus/snippetTests/api/yamlParser6.txt +92 -0
- package/test/corpus/snippetTests/api/yamlRenderer1.yml.txt +41 -0
- package/test/corpus/snippetTests/api/yamlRenderer2b.txt +300 -0
- package/test/corpus/snippetTests/api/yamlRenderer3.yml.txt +342 -0
- package/test/corpus/snippetTests/api/yamlRenderer4.txt +441 -0
- package/test/corpus/snippetTests/api/yamlRenderer5.txt +441 -0
- package/test/corpus/snippetTests/api/yamlRenderer6.yml.txt +163 -0
- package/test/corpus/snippetTests/api/yamlRenderer7.txt +30 -0
- package/test/corpus/snippetTests/api/yamlRenderer8.yml.txt +142 -0
- package/test/corpus/snippetTests/api/yamlRendererBug66849708.yml.txt +106 -0
- package/test/corpus/snippetTests/api/yamlRendererEmpty.yml.txt +326 -0
- package/test/corpus/snippetTests/api/yamlRendererIndentationWidth2.yml.txt +227 -0
- package/test/corpus/snippetTests/api/yamlRendererIndentationWidth4.yml.txt +32 -0
- package/test/corpus/snippetTests/api/yamlRendererIndentationWidth5.yml.txt +32 -0
- package/test/corpus/snippetTests/api/yamlRendererStream1.txt +140 -0
- package/test/corpus/snippetTests/api/yamlRendererStringsYaml11.txt +22 -0
- package/test/corpus/snippetTests/api/yamlRendererStringsYaml12.txt +22 -0
- package/test/corpus/snippetTests/basic/amendsChains.txt +275 -0
- package/test/corpus/snippetTests/basic/as.txt +1468 -0
- package/test/corpus/snippetTests/basic/as2.txt +1077 -0
- package/test/corpus/snippetTests/basic/as3.txt +297 -0
- package/test/corpus/snippetTests/basic/baseModule.txt +11 -0
- package/test/corpus/snippetTests/basic/boolean.txt +430 -0
- package/test/corpus/snippetTests/basic/constModifier.txt +324 -0
- package/test/corpus/snippetTests/basic/constModifier2.txt +227 -0
- package/test/corpus/snippetTests/basic/constModifier3.txt +136 -0
- package/test/corpus/snippetTests/basic/constModifier4.txt +64 -0
- package/test/corpus/snippetTests/basic/constModifier5.txt +68 -0
- package/test/corpus/snippetTests/basic/dataSize.txt +658 -0
- package/test/corpus/snippetTests/basic/duration.txt +618 -0
- package/test/corpus/snippetTests/basic/exceptions.txt +18 -0
- package/test/corpus/snippetTests/basic/fixedProperty1.txt +62 -0
- package/test/corpus/snippetTests/basic/fixedProperty2.txt +33 -0
- package/test/corpus/snippetTests/basic/fixedProperty3.txt +31 -0
- package/test/corpus/snippetTests/basic/fixedProperty4.txt +15 -0
- package/test/corpus/snippetTests/basic/fixedProperty5.txt +20 -0
- package/test/corpus/snippetTests/basic/fixedProperty6.txt +15 -0
- package/test/corpus/snippetTests/basic/if.txt +83 -0
- package/test/corpus/snippetTests/basic/import1.txt +51 -0
- package/test/corpus/snippetTests/basic/import1b.txt +51 -0
- package/test/corpus/snippetTests/basic/import2.txt +34 -0
- package/test/corpus/snippetTests/basic/import3.txt +34 -0
- package/test/corpus/snippetTests/basic/imported.txt +19 -0
- package/test/corpus/snippetTests/basic/indexExpressions.txt +53 -0
- package/test/corpus/snippetTests/basic/intseq.txt +365 -0
- package/test/corpus/snippetTests/basic/is.txt +1504 -0
- package/test/corpus/snippetTests/basic/is2.txt +677 -0
- package/test/corpus/snippetTests/basic/let.txt +515 -0
- package/test/corpus/snippetTests/basic/letTyped.txt +293 -0
- package/test/corpus/snippetTests/basic/list.txt +252 -0
- package/test/corpus/snippetTests/basic/localMethodDynamicBinding.txt +187 -0
- package/test/corpus/snippetTests/basic/localMethodInAmendingModule.txt +216 -0
- package/test/corpus/snippetTests/basic/localMethodOverride1.txt +152 -0
- package/test/corpus/snippetTests/basic/localMethodOverride2.txt +173 -0
- package/test/corpus/snippetTests/basic/localMethodTyped.txt +564 -0
- package/test/corpus/snippetTests/basic/localMethodTyped2.txt +580 -0
- package/test/corpus/snippetTests/basic/localMethodTyped3.txt +218 -0
- package/test/corpus/snippetTests/basic/localMethodTyped4.txt +232 -0
- package/test/corpus/snippetTests/basic/localMethodTyped5.txt +211 -0
- package/test/corpus/snippetTests/basic/localMethodTyped6.txt +225 -0
- package/test/corpus/snippetTests/basic/localMethodUntyped.txt +488 -0
- package/test/corpus/snippetTests/basic/localModuleMemberOverride1.txt +227 -0
- package/test/corpus/snippetTests/basic/localModuleMemberOverride2.txt +202 -0
- package/test/corpus/snippetTests/basic/localProperty1.txt +33 -0
- package/test/corpus/snippetTests/basic/localProperty2.txt +77 -0
- package/test/corpus/snippetTests/basic/localPropertyAmendInAmendingModule.txt +25 -0
- package/test/corpus/snippetTests/basic/localPropertyInAmendingModule.txt +205 -0
- package/test/corpus/snippetTests/basic/localPropertyOverride1.txt +131 -0
- package/test/corpus/snippetTests/basic/localPropertyOverride2.txt +152 -0
- package/test/corpus/snippetTests/basic/localPropertyOverride3.txt +52 -0
- package/test/corpus/snippetTests/basic/localTypedClassMember.txt +277 -0
- package/test/corpus/snippetTests/basic/localTypedModuleMember.txt +265 -0
- package/test/corpus/snippetTests/basic/localTypedObjectMember.txt +268 -0
- package/test/corpus/snippetTests/basic/map.txt +398 -0
- package/test/corpus/snippetTests/basic/minPklVersion.txt +40 -0
- package/test/corpus/snippetTests/basic/moduleRef1.txt +108 -0
- package/test/corpus/snippetTests/basic/moduleRef2.txt +80 -0
- package/test/corpus/snippetTests/basic/moduleRef3.txt +112 -0
- package/test/corpus/snippetTests/basic/moduleRefLibrary.txt +33 -0
- package/test/corpus/snippetTests/basic/new.txt +1028 -0
- package/test/corpus/snippetTests/basic/newInAmendingModuleMethod.txt +116 -0
- package/test/corpus/snippetTests/basic/newInsideIf.txt +841 -0
- package/test/corpus/snippetTests/basic/newInsideLet.txt +869 -0
- package/test/corpus/snippetTests/basic/newType.txt +686 -0
- package/test/corpus/snippetTests/basic/nonNull.txt +131 -0
- package/test/corpus/snippetTests/basic/nullable.txt +239 -0
- package/test/corpus/snippetTests/basic/objectMember.txt +129 -0
- package/test/corpus/snippetTests/basic/objectMemberInvalid.txt +18 -0
- package/test/corpus/snippetTests/basic/objectMemberInvalid2.txt +18 -0
- package/test/corpus/snippetTests/basic/objectMemberInvalid3.txt +22 -0
- package/test/corpus/snippetTests/basic/parens.txt +59 -0
- package/test/corpus/snippetTests/basic/propertyDefaults.txt +126 -0
- package/test/corpus/snippetTests/basic/read.txt +250 -0
- package/test/corpus/snippetTests/basic/readGlob.txt +209 -0
- package/test/corpus/snippetTests/basic/semicolon.txt +18 -0
- package/test/corpus/snippetTests/basic/set.txt +340 -0
- package/test/corpus/snippetTests/basic/trace.txt +130 -0
- package/test/corpus/snippetTests/basic/typeResolution1.txt +31 -0
- package/test/corpus/snippetTests/basic/typeResolution2.txt +37 -0
- package/test/corpus/snippetTests/basic/typeResolution3.txt +63 -0
- package/test/corpus/snippetTests/basic/typeResolution4.txt +61 -0
- package/test/corpus/snippetTests/basic/underscore.txt +419 -0
- package/test/corpus/snippetTests/classes/class1.txt +54 -0
- package/test/corpus/snippetTests/classes/class2.txt +123 -0
- package/test/corpus/snippetTests/classes/class2a.txt +110 -0
- package/test/corpus/snippetTests/classes/class3.txt +65 -0
- package/test/corpus/snippetTests/classes/class4.txt +58 -0
- package/test/corpus/snippetTests/classes/constraints1.txt +141 -0
- package/test/corpus/snippetTests/classes/constraints11.txt +201 -0
- package/test/corpus/snippetTests/classes/constraints12.txt +204 -0
- package/test/corpus/snippetTests/classes/constraints13.txt +86 -0
- package/test/corpus/snippetTests/classes/constraints14.txt +39 -0
- package/test/corpus/snippetTests/classes/constraints2.txt +69 -0
- package/test/corpus/snippetTests/classes/constraints3.txt +97 -0
- package/test/corpus/snippetTests/classes/constraints4.txt +86 -0
- package/test/corpus/snippetTests/classes/constraints5.txt +71 -0
- package/test/corpus/snippetTests/classes/constraints6.txt +85 -0
- package/test/corpus/snippetTests/classes/constraints7.txt +148 -0
- package/test/corpus/snippetTests/classes/constraints8.txt +103 -0
- package/test/corpus/snippetTests/classes/constraints9.txt +92 -0
- package/test/corpus/snippetTests/classes/constraintsLambdaThis.txt +216 -0
- package/test/corpus/snippetTests/classes/equality.txt +123 -0
- package/test/corpus/snippetTests/classes/externalClass.txt +12 -0
- package/test/corpus/snippetTests/classes/externalFunction.txt +18 -0
- package/test/corpus/snippetTests/classes/externalProperty.txt +20 -0
- package/test/corpus/snippetTests/classes/functions1.txt +77 -0
- package/test/corpus/snippetTests/classes/functions2.txt +56 -0
- package/test/corpus/snippetTests/classes/functions3.txt +81 -0
- package/test/corpus/snippetTests/classes/functions4.txt +125 -0
- package/test/corpus/snippetTests/classes/inheritance1.txt +98 -0
- package/test/corpus/snippetTests/classes/inheritance2.txt +91 -0
- package/test/corpus/snippetTests/classes/invalidInstantiation1.txt +16 -0
- package/test/corpus/snippetTests/classes/invalidInstantiation2.txt +21 -0
- package/test/corpus/snippetTests/classes/lambdaConstraints1.txt +190 -0
- package/test/corpus/snippetTests/classes/listConstraints1.txt +312 -0
- package/test/corpus/snippetTests/classes/mapConstraints1.txt +495 -0
- package/test/corpus/snippetTests/classes/nullableTypes.txt +187 -0
- package/test/corpus/snippetTests/classes/setConstraints1.txt +312 -0
- package/test/corpus/snippetTests/classes/supercalls.txt +317 -0
- package/test/corpus/snippetTests/classes/unionTypes.txt +543 -0
- package/test/corpus/snippetTests/classes/unionTypesErrorAlias.txt +93 -0
- package/test/corpus/snippetTests/classes/unionTypesErrorDifferent1.txt +47 -0
- package/test/corpus/snippetTests/classes/unionTypesErrorDifferent2.txt +52 -0
- package/test/corpus/snippetTests/classes/unionTypesErrorMultipleAliases.txt +36 -0
- package/test/corpus/snippetTests/classes/unionTypesErrorNested.txt +99 -0
- package/test/corpus/snippetTests/classes/unionTypesErrorSimple.txt +42 -0
- package/test/corpus/snippetTests/classes/unionTypesErrorString1.txt +43 -0
- package/test/corpus/snippetTests/classes/unionTypesErrorString2.txt +85 -0
- package/test/corpus/snippetTests/classes/wrongType1.txt +34 -0
- package/test/corpus/snippetTests/classes/wrongType2.txt +47 -0
- package/test/corpus/snippetTests/classes/wrongType3.txt +71 -0
- package/test/corpus/snippetTests/classes/wrongType4.txt +77 -0
- package/test/corpus/snippetTests/classes/wrongType6.txt +43 -0
- package/test/corpus/snippetTests/errors/abstractOpenMember.txt +13 -0
- package/test/corpus/snippetTests/errors/analyzeImportsCannotFindModule.txt +41 -0
- package/test/corpus/snippetTests/errors/analyzeImportsInvalidGlob.txt +41 -0
- package/test/corpus/snippetTests/errors/analyzeInvalidHttpModule.txt +26 -0
- package/test/corpus/snippetTests/errors/analyzeInvalidModuleUri.txt +26 -0
- package/test/corpus/snippetTests/errors/analyzeRelativeModuleUri.txt +26 -0
- package/test/corpus/snippetTests/errors/anyConverterError.txt +56 -0
- package/test/corpus/snippetTests/errors/baseModule.txt +24 -0
- package/test/corpus/snippetTests/errors/cannotAmendFixedProperty1.txt +62 -0
- package/test/corpus/snippetTests/errors/cannotAmendFixedProperty2.txt +24 -0
- package/test/corpus/snippetTests/errors/cannotAssignFixedProperty1.txt +45 -0
- package/test/corpus/snippetTests/errors/cannotAssignFixedProperty2.txt +19 -0
- package/test/corpus/snippetTests/errors/cannotAssignFixedProperty3.txt +31 -0
- package/test/corpus/snippetTests/errors/cannotAssignToNothing.txt +15 -0
- package/test/corpus/snippetTests/errors/cannotChangeFixed1.txt +35 -0
- package/test/corpus/snippetTests/errors/cannotChangeFixed2.txt +35 -0
- package/test/corpus/snippetTests/errors/cannotFindMapKey.txt +39 -0
- package/test/corpus/snippetTests/errors/cannotFindStdLibModule.txt +20 -0
- package/test/corpus/snippetTests/errors/cannotInferParent2.txt +14 -0
- package/test/corpus/snippetTests/errors/cannotInferParent3.txt +48 -0
- package/test/corpus/snippetTests/errors/cannotInstantiateAbstractModule.txt +21 -0
- package/test/corpus/snippetTests/errors/cannotRenderMixin.txt +41 -0
- package/test/corpus/snippetTests/errors/classExtendsSelf.txt +27 -0
- package/test/corpus/snippetTests/errors/constraintDetails1.txt +80 -0
- package/test/corpus/snippetTests/errors/constraintDetails2.txt +77 -0
- package/test/corpus/snippetTests/errors/constraintDetails3.txt +87 -0
- package/test/corpus/snippetTests/errors/duplicateTypeParameter.txt +22 -0
- package/test/corpus/snippetTests/errors/extendExternalClass.txt +12 -0
- package/test/corpus/snippetTests/errors/extendTypeAlias.txt +33 -0
- package/test/corpus/snippetTests/errors/forGeneratorCannotGenerateMethods.txt +30 -0
- package/test/corpus/snippetTests/errors/forGeneratorCannotGenerateProperties.txt +28 -0
- package/test/corpus/snippetTests/errors/forGeneratorCannotIterateOverThisValue.txt +21 -0
- package/test/corpus/snippetTests/errors/forGeneratorCannotIterateOverTyped.txt +27 -0
- package/test/corpus/snippetTests/errors/forGeneratorDuplicateParams1.txt +38 -0
- package/test/corpus/snippetTests/errors/fullStackTraces.txt +64 -0
- package/test/corpus/snippetTests/errors/fullStackTraces2.txt +56 -0
- package/test/corpus/snippetTests/errors/functionNotFoundInClass.txt +35 -0
- package/test/corpus/snippetTests/errors/functionNotFoundInModule.txt +25 -0
- package/test/corpus/snippetTests/errors/functionNotFoundInScope.txt +38 -0
- package/test/corpus/snippetTests/errors/functionNotFoundMaybeLambda.txt +24 -0
- package/test/corpus/snippetTests/errors/functionNotFoundMaybeProperty.txt +18 -0
- package/test/corpus/snippetTests/errors/intrinsifiedTypeAlias1.txt +16 -0
- package/test/corpus/snippetTests/errors/intrinsifiedTypeAlias2.txt +16 -0
- package/test/corpus/snippetTests/errors/intrinsifiedTypeAlias3.txt +15 -0
- package/test/corpus/snippetTests/errors/intrinsifiedTypeAlias4.txt +15 -0
- package/test/corpus/snippetTests/errors/invalidClassMethodModifier.txt +29 -0
- package/test/corpus/snippetTests/errors/invalidClassModifier.txt +11 -0
- package/test/corpus/snippetTests/errors/invalidClassModifier2.txt +12 -0
- package/test/corpus/snippetTests/errors/invalidClassPropertyModifier.txt +31 -0
- package/test/corpus/snippetTests/errors/invalidGlobImport1.txt +19 -0
- package/test/corpus/snippetTests/errors/invalidGlobImport4.txt +19 -0
- package/test/corpus/snippetTests/errors/invalidGlobImport5.txt +20 -0
- package/test/corpus/snippetTests/errors/invalidGlobImport6.txt +14 -0
- package/test/corpus/snippetTests/errors/invalidGlobImport7.txt +21 -0
- package/test/corpus/snippetTests/errors/invalidGlobImport8.txt +22 -0
- package/test/corpus/snippetTests/errors/invalidGlobRead1.txt +14 -0
- package/test/corpus/snippetTests/errors/invalidGlobRead2.txt +14 -0
- package/test/corpus/snippetTests/errors/invalidGlobRead3.txt +14 -0
- package/test/corpus/snippetTests/errors/invalidImportBackslashSep.txt +14 -0
- package/test/corpus/snippetTests/errors/invalidImportUri.txt +19 -0
- package/test/corpus/snippetTests/errors/invalidMethodModifier.txt +14 -0
- package/test/corpus/snippetTests/errors/invalidModuleModifier.txt +20 -0
- package/test/corpus/snippetTests/errors/invalidObjectPropertyModifier.txt +17 -0
- package/test/corpus/snippetTests/errors/invalidOutput1.txt +17 -0
- package/test/corpus/snippetTests/errors/invalidOutput2.txt +22 -0
- package/test/corpus/snippetTests/errors/invalidOutput3.txt +12 -0
- package/test/corpus/snippetTests/errors/invalidPropertyModifier.txt +16 -0
- package/test/corpus/snippetTests/errors/invalidTripleDotSyntax1.txt +11 -0
- package/test/corpus/snippetTests/errors/invalidTripleDotSyntax2.txt +11 -0
- package/test/corpus/snippetTests/errors/invalidTypeAliasModifier.txt +14 -0
- package/test/corpus/snippetTests/errors/invalidTypeName1.txt +24 -0
- package/test/corpus/snippetTests/errors/invalidTypeName2.txt +31 -0
- package/test/corpus/snippetTests/errors/invalidTypeName3.txt +19 -0
- package/test/corpus/snippetTests/errors/invalidTypeName4.txt +24 -0
- package/test/corpus/snippetTests/errors/letExpressionError1.txt +24 -0
- package/test/corpus/snippetTests/errors/letExpressionError2.txt +27 -0
- package/test/corpus/snippetTests/errors/letExpressionErrorTyped.txt +27 -0
- package/test/corpus/snippetTests/errors/listingTypeCheckError1.txt +24 -0
- package/test/corpus/snippetTests/errors/listingTypeCheckError2.txt +30 -0
- package/test/corpus/snippetTests/errors/listingTypeCheckError3.txt +36 -0
- package/test/corpus/snippetTests/errors/listingTypeCheckError4.txt +43 -0
- package/test/corpus/snippetTests/errors/listingTypeCheckError5.txt +40 -0
- package/test/corpus/snippetTests/errors/listingTypeCheckError6.txt +58 -0
- package/test/corpus/snippetTests/errors/listingTypeCheckError7.txt +42 -0
- package/test/corpus/snippetTests/errors/listingTypeCheckError8.txt +84 -0
- package/test/corpus/snippetTests/errors/listingTypeCheckError9.txt +97 -0
- package/test/corpus/snippetTests/errors/localFixedMember.txt +19 -0
- package/test/corpus/snippetTests/errors/localFunctionWithTypeParameter.txt +18 -0
- package/test/corpus/snippetTests/errors/localHiddenMember.txt +17 -0
- package/test/corpus/snippetTests/errors/mappingTypeCheckError1.txt +29 -0
- package/test/corpus/snippetTests/errors/mappingTypeCheckError10.txt +49 -0
- package/test/corpus/snippetTests/errors/mappingTypeCheckError11.txt +106 -0
- package/test/corpus/snippetTests/errors/mappingTypeCheckError2.txt +30 -0
- package/test/corpus/snippetTests/errors/mappingTypeCheckError3.txt +30 -0
- package/test/corpus/snippetTests/errors/mappingTypeCheckError4.txt +36 -0
- package/test/corpus/snippetTests/errors/mappingTypeCheckError5.txt +41 -0
- package/test/corpus/snippetTests/errors/mappingTypeCheckError6.txt +75 -0
- package/test/corpus/snippetTests/errors/mappingTypeCheckError7.txt +45 -0
- package/test/corpus/snippetTests/errors/mappingTypeCheckError8.txt +33 -0
- package/test/corpus/snippetTests/errors/mappingTypeCheckError9.txt +69 -0
- package/test/corpus/snippetTests/errors/missingLocalPropertyValue1.txt +15 -0
- package/test/corpus/snippetTests/errors/missingLocalPropertyValue2.txt +22 -0
- package/test/corpus/snippetTests/errors/moduleAmendsSelf.txt +13 -0
- package/test/corpus/snippetTests/errors/moduleAmendsVersionCheck.txt +13 -0
- package/test/corpus/snippetTests/errors/moduleAmendsVersionCheck2.txt +22 -0
- package/test/corpus/snippetTests/errors/moduleExpected.txt +43 -0
- package/test/corpus/snippetTests/errors/moduleExtendsSelf.txt +20 -0
- package/test/corpus/snippetTests/errors/moduleExtendsVersionCheck.txt +13 -0
- package/test/corpus/snippetTests/errors/moduleExtendsVersionCheck2.txt +22 -0
- package/test/corpus/snippetTests/errors/moduleImportVersionCheck.txt +20 -0
- package/test/corpus/snippetTests/errors/moduleWithHighMinPklVersion.txt +29 -0
- package/test/corpus/snippetTests/errors/noDefault.txt +23 -0
- package/test/corpus/snippetTests/errors/noDefault2.txt +31 -0
- package/test/corpus/snippetTests/errors/objectCannotHaveElement.txt +72 -0
- package/test/corpus/snippetTests/errors/objectCannotHaveElement2.txt +98 -0
- package/test/corpus/snippetTests/errors/objectCannotHavePredicateMember.txt +25 -0
- package/test/corpus/snippetTests/errors/outOfRange1.txt +14 -0
- package/test/corpus/snippetTests/errors/outOfRange2.txt +17 -0
- package/test/corpus/snippetTests/errors/outOfRange3.txt +21 -0
- package/test/corpus/snippetTests/errors/propertyNotFound1.txt +32 -0
- package/test/corpus/snippetTests/errors/propertyNotFound2.txt +18 -0
- package/test/corpus/snippetTests/errors/refusingToLoadModule.txt +18 -0
- package/test/corpus/snippetTests/errors/spreadSyntaxCannotHaveElement.txt +38 -0
- package/test/corpus/snippetTests/errors/spreadSyntaxCannotHaveEntry.txt +34 -0
- package/test/corpus/snippetTests/errors/spreadSyntaxCannotHaveProperty.txt +34 -0
- package/test/corpus/snippetTests/errors/spreadSyntaxCannotIterateOverTyped.txt +44 -0
- package/test/corpus/snippetTests/errors/spreadSyntaxCannotSpreadListIntoMapping.txt +37 -0
- package/test/corpus/snippetTests/errors/spreadSyntaxDuplicateEntry1.txt +39 -0
- package/test/corpus/snippetTests/errors/spreadSyntaxDuplicateEntry2.txt +39 -0
- package/test/corpus/snippetTests/errors/spreadSyntaxDuplicateProperty1.txt +32 -0
- package/test/corpus/snippetTests/errors/spreadSyntaxDuplicateProperty2.txt +32 -0
- package/test/corpus/snippetTests/errors/spreadSyntaxNullValue.txt +20 -0
- package/test/corpus/snippetTests/errors/spreadSyntaxUnknownTypedProperty.txt +47 -0
- package/test/corpus/snippetTests/errors/stackTraceWithQuotedMemberName.txt +23 -0
- package/test/corpus/snippetTests/errors/supercalls.txt +18 -0
- package/test/corpus/snippetTests/errors/typeMismatchHelper.txt +19 -0
- package/test/corpus/snippetTests/errors/typeMismatchWithSameQualifiedClassName.txt +38 -0
- package/test/corpus/snippetTests/errors/typeMismatchWithSameQualifiedModuleName.txt +28 -0
- package/test/corpus/snippetTests/errors/undefinedOp1.txt +12 -0
- package/test/corpus/snippetTests/errors/undefinedOp2.txt +14 -0
- package/test/corpus/snippetTests/errors/undefinedOp3.txt +24 -0
- package/test/corpus/snippetTests/errors/undefinedProperty1.txt +28 -0
- package/test/corpus/snippetTests/errors/undefinedProperty2.txt +15 -0
- package/test/corpus/snippetTests/errors/undefinedProperty3.txt +95 -0
- package/test/corpus/snippetTests/errors/undefinedProperty4.txt +141 -0
- package/test/corpus/snippetTests/errors/undefinedProperty5.txt +160 -0
- package/test/corpus/snippetTests/errors/undefinedProperty6.txt +40 -0
- package/test/corpus/snippetTests/errors/undefinedProperty7.txt +35 -0
- package/test/corpus/snippetTests/errors/undefinedProperty8.txt +34 -0
- package/test/corpus/snippetTests/errors/underscoreLambda.txt +37 -0
- package/test/corpus/snippetTests/errors/underscoreLet.txt +17 -0
- package/test/corpus/snippetTests/errors/userDefinedTypeParameter1.txt +22 -0
- package/test/corpus/snippetTests/errors/userDefinedTypeParameter2.txt +32 -0
- package/test/corpus/snippetTests/errors/wrongForGeneratorType1.txt +35 -0
- package/test/corpus/snippetTests/errors/wrongForGeneratorType2.txt +37 -0
- package/test/corpus/snippetTests/errors/wrongNumberOfMapArguments.txt +16 -0
- package/test/corpus/snippetTests/generators/duplicateDefinition1.txt +23 -0
- package/test/corpus/snippetTests/generators/duplicateDefinition2.txt +30 -0
- package/test/corpus/snippetTests/generators/duplicateDefinition3.txt +26 -0
- package/test/corpus/snippetTests/generators/elementGenerators.txt +2628 -0
- package/test/corpus/snippetTests/generators/elementGeneratorsTyped.txt +1593 -0
- package/test/corpus/snippetTests/generators/entryGenerators.txt +3013 -0
- package/test/corpus/snippetTests/generators/entryGeneratorsTyped.txt +1858 -0
- package/test/corpus/snippetTests/generators/forGeneratorInMixins.txt +301 -0
- package/test/corpus/snippetTests/generators/forGeneratorLexicalScope.txt +199 -0
- package/test/corpus/snippetTests/generators/forGeneratorNestedReference.txt +277 -0
- package/test/corpus/snippetTests/generators/forGeneratorNestedReference2.txt +98 -0
- package/test/corpus/snippetTests/generators/forGeneratorVariableShadowing.txt +177 -0
- package/test/corpus/snippetTests/generators/generatorNoMembers.txt +157 -0
- package/test/corpus/snippetTests/generators/predicateMembersDynamicListing.txt +461 -0
- package/test/corpus/snippetTests/generators/predicateMembersDynamicMapping.txt +473 -0
- package/test/corpus/snippetTests/generators/predicateMembersListing.txt +463 -0
- package/test/corpus/snippetTests/generators/predicateMembersMapping.txt +474 -0
- package/test/corpus/snippetTests/generators/predicateMembersThis.txt +82 -0
- package/test/corpus/snippetTests/generators/propertyGenerators.txt +104 -0
- package/test/corpus/snippetTests/generators/spreadSyntaxDynamic.txt +411 -0
- package/test/corpus/snippetTests/generators/spreadSyntaxListing.txt +496 -0
- package/test/corpus/snippetTests/generators/spreadSyntaxMapping.txt +655 -0
- package/test/corpus/snippetTests/generators/spreadSyntaxNoSpace.txt +32 -0
- package/test/corpus/snippetTests/generators/spreadSyntaxNullable.txt +37 -0
- package/test/corpus/snippetTests/generators/spreadSyntaxTyped.txt +59 -0
- package/test/corpus/snippetTests/implementation/equality.txt +198 -0
- package/test/corpus/snippetTests/implementation/inequality.txt +198 -0
- package/test/corpus/snippetTests/internal/polymorphicCallSite.txt +499 -0
- package/test/corpus/snippetTests/lambdas/amendLambdaDef.txt +310 -0
- package/test/corpus/snippetTests/lambdas/amendLambdaExpr.txt +325 -0
- package/test/corpus/snippetTests/lambdas/amendLambdaExternalClassError.txt +45 -0
- package/test/corpus/snippetTests/lambdas/amendLambdaParameters.txt +155 -0
- package/test/corpus/snippetTests/lambdas/amendLambdaParametersTyped.txt +420 -0
- package/test/corpus/snippetTests/lambdas/amendLambdaThatReturnsAnotherLambda.txt +380 -0
- package/test/corpus/snippetTests/lambdas/amendLambdaTooFewArgsError.txt +60 -0
- package/test/corpus/snippetTests/lambdas/amendLambdaTooManyArgsError.txt +62 -0
- package/test/corpus/snippetTests/lambdas/equality.txt +62 -0
- package/test/corpus/snippetTests/lambdas/inequality.txt +62 -0
- package/test/corpus/snippetTests/lambdas/lambda1.txt +85 -0
- package/test/corpus/snippetTests/lambdas/lambda2.txt +78 -0
- package/test/corpus/snippetTests/lambdas/lambda3.txt +381 -0
- package/test/corpus/snippetTests/lambdas/lambda4.txt +147 -0
- package/test/corpus/snippetTests/lambdas/lambda5.txt +307 -0
- package/test/corpus/snippetTests/lambdas/lambdaStackTrace1.txt +35 -0
- package/test/corpus/snippetTests/lambdas/lambdaStackTrace2.txt +37 -0
- package/test/corpus/snippetTests/lambdas/lambdaStackTrace3.txt +33 -0
- package/test/corpus/snippetTests/lambdas/pipeOperator.txt +189 -0
- package/test/corpus/snippetTests/lambdas/tooManyLambdaParams.txt +27 -0
- package/test/corpus/snippetTests/lambdas/typedLambdas.txt +278 -0
- package/test/corpus/snippetTests/lambdas/wrongArgumentListLength.txt +37 -0
- package/test/corpus/snippetTests/listings/cacheStealing.txt +56 -0
- package/test/corpus/snippetTests/listings/cacheStealingTypeCheck.txt +27 -0
- package/test/corpus/snippetTests/listings/default.txt +133 -0
- package/test/corpus/snippetTests/listings/equality.txt +341 -0
- package/test/corpus/snippetTests/listings/hashCode.txt +438 -0
- package/test/corpus/snippetTests/listings/inequality.txt +173 -0
- package/test/corpus/snippetTests/listings/listing1.txt +360 -0
- package/test/corpus/snippetTests/listings/listing2.txt +755 -0
- package/test/corpus/snippetTests/listings/listing3.txt +490 -0
- package/test/corpus/snippetTests/listings/listing4.txt +156 -0
- package/test/corpus/snippetTests/listings/listing6.txt +208 -0
- package/test/corpus/snippetTests/listings/listing7.txt +71 -0
- package/test/corpus/snippetTests/listings/typeCheck.txt +2506 -0
- package/test/corpus/snippetTests/listings/wrongIndex.txt +121 -0
- package/test/corpus/snippetTests/listings/wrongParent.txt +253 -0
- package/test/corpus/snippetTests/listings2/default.txt +157 -0
- package/test/corpus/snippetTests/listings2/equality.txt +358 -0
- package/test/corpus/snippetTests/listings2/inequality.txt +227 -0
- package/test/corpus/snippetTests/listings2/listing1.txt +372 -0
- package/test/corpus/snippetTests/listings2/listing2.txt +904 -0
- package/test/corpus/snippetTests/listings2/listing3.txt +568 -0
- package/test/corpus/snippetTests/listings2/typeCheck.txt +336 -0
- package/test/corpus/snippetTests/listings2/wrongIndex.txt +151 -0
- package/test/corpus/snippetTests/listings2/wrongParent.txt +313 -0
- package/test/corpus/snippetTests/mappings/default.txt +174 -0
- package/test/corpus/snippetTests/mappings/duplicateComputedKey.txt +85 -0
- package/test/corpus/snippetTests/mappings/duplicateConstantKey.txt +32 -0
- package/test/corpus/snippetTests/mappings/equality.txt +383 -0
- package/test/corpus/snippetTests/mappings/hashCode.txt +461 -0
- package/test/corpus/snippetTests/mappings/inequality.txt +198 -0
- package/test/corpus/snippetTests/mappings/mapping1.txt +590 -0
- package/test/corpus/snippetTests/mappings/mapping2.txt +491 -0
- package/test/corpus/snippetTests/mappings/stringKeyNotFound.txt +50 -0
- package/test/corpus/snippetTests/mappings/typeCheck.txt +2877 -0
- package/test/corpus/snippetTests/mappings/wrongParent.txt +262 -0
- package/test/corpus/snippetTests/mappings2/default.txt +195 -0
- package/test/corpus/snippetTests/mappings2/duplicateComputedKey.txt +99 -0
- package/test/corpus/snippetTests/mappings2/duplicateConstantKey.txt +39 -0
- package/test/corpus/snippetTests/mappings2/equality.txt +416 -0
- package/test/corpus/snippetTests/mappings2/inequality.txt +268 -0
- package/test/corpus/snippetTests/mappings2/mapping1.txt +604 -0
- package/test/corpus/snippetTests/mappings2/mapping2.txt +595 -0
- package/test/corpus/snippetTests/mappings2/stringKeyNotFound.txt +57 -0
- package/test/corpus/snippetTests/mappings2/typeCheck.txt +582 -0
- package/test/corpus/snippetTests/mappings2/wrongParent.txt +334 -0
- package/test/corpus/snippetTests/methods/methodParameterConstraints1.txt +220 -0
- package/test/corpus/snippetTests/methods/methodParameterConstraints2.txt +382 -0
- package/test/corpus/snippetTests/methods/methodParameterTypes2.txt +734 -0
- package/test/corpus/snippetTests/methods/methodParameterTypes3.txt +196 -0
- package/test/corpus/snippetTests/modules/amendModule1.txt +36 -0
- package/test/corpus/snippetTests/modules/amendModule2.txt +28 -0
- package/test/corpus/snippetTests/modules/amendModule3.txt +24 -0
- package/test/corpus/snippetTests/modules/amendModule4.txt +35 -0
- package/test/corpus/snippetTests/modules/amendModule5.txt +68 -0
- package/test/corpus/snippetTests/modules/amendModule6.txt +13 -0
- package/test/corpus/snippetTests/modules/equality.txt +91 -0
- package/test/corpus/snippetTests/modules/extendModule1.txt +80 -0
- package/test/corpus/snippetTests/modules/externalFunction.txt +14 -0
- package/test/corpus/snippetTests/modules/externalProperty.txt +16 -0
- package/test/corpus/snippetTests/modules/filename with spaces 2.txt +14 -0
- package/test/corpus/snippetTests/modules/filename with spaces.txt +13 -0
- package/test/corpus/snippetTests/modules/functions.txt +264 -0
- package/test/corpus/snippetTests/modules/invalidAmend1.txt +18 -0
- package/test/corpus/snippetTests/modules/invalidAmend2.txt +19 -0
- package/test/corpus/snippetTests/modules/invalidAmend3.txt +23 -0
- package/test/corpus/snippetTests/modules/invalidAmend4.txt +21 -0
- package/test/corpus/snippetTests/modules/invalidAmend5.txt +17 -0
- package/test/corpus/snippetTests/modules/invalidAmend6.txt +22 -0
- package/test/corpus/snippetTests/modules/invalidExtend1.txt +18 -0
- package/test/corpus/snippetTests/modules/invalidExtend2.txt +13 -0
- package/test/corpus/snippetTests/modules/invalidExtend3.txt +13 -0
- package/test/corpus/snippetTests/modules/library.txt +77 -0
- package/test/corpus/snippetTests/modules/lists.txt +26 -0
- package/test/corpus/snippetTests/modules/objects.txt +22 -0
- package/test/corpus/snippetTests/modules/recursiveModule1.txt +51 -0
- package/test/corpus/snippetTests/modules/recursiveModule2.txt +26 -0
- package/test/corpus/snippetTests/modules/supercalls1.txt +43 -0
- package/test/corpus/snippetTests/modules/supercalls2.txt +76 -0
- package/test/corpus/snippetTests/modules/supercalls3.txt +142 -0
- package/test/corpus/snippetTests/modules/typedModuleMethods1.txt +229 -0
- package/test/corpus/snippetTests/modules/typedModuleProperties1.txt +106 -0
- package/test/corpus/snippetTests/modules/typedModuleProperties2.txt +16 -0
- package/test/corpus/snippetTests/modules/typedModuleProperties3.txt +20 -0
- package/test/corpus/snippetTests/modules//346/227/245/346/234/254/350/252/236.txt +45 -0
- package/test/corpus/snippetTests/modules//346/227/245/346/234/254/350/252/236_error.txt +14 -0
- package/test/corpus/snippetTests/objects/closure.txt +143 -0
- package/test/corpus/snippetTests/objects/configureObjectAssign.txt +78 -0
- package/test/corpus/snippetTests/objects/equality.txt +989 -0
- package/test/corpus/snippetTests/objects/hashCode.txt +566 -0
- package/test/corpus/snippetTests/objects/implicitReceiver1.txt +37 -0
- package/test/corpus/snippetTests/objects/implicitReceiver2.txt +33 -0
- package/test/corpus/snippetTests/objects/implicitReceiver3.txt +29 -0
- package/test/corpus/snippetTests/objects/implicitReceiver4.txt +25 -0
- package/test/corpus/snippetTests/objects/inequality.txt +777 -0
- package/test/corpus/snippetTests/objects/lateBinding1.txt +60 -0
- package/test/corpus/snippetTests/objects/lateBinding2.txt +60 -0
- package/test/corpus/snippetTests/objects/lateBinding3.txt +81 -0
- package/test/corpus/snippetTests/objects/lateBinding4.txt +77 -0
- package/test/corpus/snippetTests/objects/outer.txt +91 -0
- package/test/corpus/snippetTests/objects/outer2.txt +28 -0
- package/test/corpus/snippetTests/objects/super1.txt +67 -0
- package/test/corpus/snippetTests/objects/super2.txt +59 -0
- package/test/corpus/snippetTests/objects/super3.txt +59 -0
- package/test/corpus/snippetTests/objects/super4.txt +66 -0
- package/test/corpus/snippetTests/objects/super5.txt +69 -0
- package/test/corpus/snippetTests/objects/this1.txt +24 -0
- package/test/corpus/snippetTests/objects/this2.txt +71 -0
- package/test/corpus/snippetTests/packages/badImport1.error.txt +14 -0
- package/test/corpus/snippetTests/packages/badImport10.error.txt +14 -0
- package/test/corpus/snippetTests/packages/badImport11.error.txt +14 -0
- package/test/corpus/snippetTests/packages/badImport2.error.txt +14 -0
- package/test/corpus/snippetTests/packages/badImport3.error.txt +14 -0
- package/test/corpus/snippetTests/packages/badImport4.error.txt +14 -0
- package/test/corpus/snippetTests/packages/badImport6.error.txt +20 -0
- package/test/corpus/snippetTests/packages/badImport7.error.txt +14 -0
- package/test/corpus/snippetTests/packages/badImport8.error.txt +14 -0
- package/test/corpus/snippetTests/packages/badImport9.error.txt +14 -0
- package/test/corpus/snippetTests/packages/badRead1.error.txt +14 -0
- package/test/corpus/snippetTests/packages/badRead2.error.txt +14 -0
- package/test/corpus/snippetTests/packages/badRead3.error.txt +14 -0
- package/test/corpus/snippetTests/packages/badRead4.error.txt +14 -0
- package/test/corpus/snippetTests/packages/badRead8.error.txt +14 -0
- package/test/corpus/snippetTests/packages/badRead9.error.txt +14 -0
- package/test/corpus/snippetTests/packages/packages1.txt +103 -0
- package/test/corpus/snippetTests/packages/packages2.txt +104 -0
- package/test/corpus/snippetTests/packages/redirects.txt +54 -0
- package/test/corpus/snippetTests/types/ThisInTypeConstraint.txt +342 -0
- package/test/corpus/snippetTests/types/currentModuleType1.txt +343 -0
- package/test/corpus/snippetTests/types/currentModuleType2.txt +351 -0
- package/test/corpus/snippetTests/types/currentModuleType3.txt +18 -0
- package/test/corpus/snippetTests/types/cyclicTypeAlias1.txt +17 -0
- package/test/corpus/snippetTests/types/cyclicTypeAlias2.txt +42 -0
- package/test/corpus/snippetTests/types/modifiersForTypes.txt +68 -0
- package/test/corpus/snippetTests/types/moduleType.txt +58 -0
- package/test/corpus/snippetTests/types/nothingType.txt +29 -0
- package/test/corpus/snippetTests/types/nothingWithUnions.txt +31 -0
- package/test/corpus/snippetTests/types/typeAlias1.txt +925 -0
- package/test/corpus/snippetTests/types/typeAlias2.txt +361 -0
- package/test/corpus/snippetTests/types/typeAliasConstraint1.txt +79 -0
- package/test/corpus/snippetTests/types/typeAliasConstraint2.txt +77 -0
- package/test/corpus/snippetTests/types/typeAliasContext.txt +26 -0
- package/test/corpus/snippetTests/types/typeAliasUnion.txt +169 -0
- package/test/corpus/string/customStringDelimiters.txt +397 -0
- package/test/corpus/string/multiline.txt +39 -0
- package/test/corpus/string/multilineInterpolation.txt +102 -0
- package/test/corpus/string/multilineInterpolation2.txt +15 -0
- package/test/corpus/string/simple.txt +13 -0
- package/test/corpus/string/singleLineEscapes.txt +64 -0
- package/test/corpus/string/singleLineInterpolation.txt +94 -0
- package/test/corpus/string/stringWithTwoSlashes.txt +20 -0
- package/test/corpus/type/unionType.txt +34 -0
- package/test/corpus/type/unionTypeDefaults.txt +46 -0
- package/tree-sitter.json +41 -0
- package/README.adoc +0 -61
- package/src/synctests.ts +0 -44
package/.editorconfig
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[*]
|
|
4
|
+
charset = utf-8
|
|
5
|
+
|
|
6
|
+
[*.{json,toml,yml,gyp}]
|
|
7
|
+
indent_style = space
|
|
8
|
+
indent_size = 2
|
|
9
|
+
|
|
10
|
+
[*.js]
|
|
11
|
+
indent_style = space
|
|
12
|
+
indent_size = 2
|
|
13
|
+
|
|
14
|
+
[*.scm]
|
|
15
|
+
indent_style = space
|
|
16
|
+
indent_size = 2
|
|
17
|
+
|
|
18
|
+
[*.{c,cc,h}]
|
|
19
|
+
indent_style = space
|
|
20
|
+
indent_size = 4
|
|
21
|
+
|
|
22
|
+
[*.rs]
|
|
23
|
+
indent_style = space
|
|
24
|
+
indent_size = 4
|
|
25
|
+
|
|
26
|
+
[*.{py,pyi}]
|
|
27
|
+
indent_style = space
|
|
28
|
+
indent_size = 4
|
|
29
|
+
|
|
30
|
+
[*.swift]
|
|
31
|
+
indent_style = space
|
|
32
|
+
indent_size = 4
|
|
33
|
+
|
|
34
|
+
[*.go]
|
|
35
|
+
indent_style = tab
|
|
36
|
+
indent_size = 8
|
|
37
|
+
|
|
38
|
+
[Makefile]
|
|
39
|
+
indent_style = tab
|
|
40
|
+
indent_size = 8
|
|
41
|
+
|
|
42
|
+
[parser.c]
|
|
43
|
+
indent_size = 2
|
|
44
|
+
|
|
45
|
+
[{alloc,array,parser}.h]
|
|
46
|
+
indent_size = 2
|
package/.gitattributes
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
* text=auto eol=lf
|
|
2
|
+
|
|
3
|
+
# Generated source files
|
|
4
|
+
src/*.json linguist-generated
|
|
5
|
+
src/parser.c linguist-generated
|
|
6
|
+
src/tree_sitter/* linguist-generated
|
|
7
|
+
|
|
8
|
+
# C bindings
|
|
9
|
+
bindings/c/** linguist-generated
|
|
10
|
+
CMakeLists.txt linguist-generated
|
|
11
|
+
Makefile linguist-generated
|
|
12
|
+
|
|
13
|
+
# Rust bindings
|
|
14
|
+
bindings/rust/* linguist-generated
|
|
15
|
+
Cargo.toml linguist-generated
|
|
16
|
+
Cargo.lock linguist-generated
|
|
17
|
+
|
|
18
|
+
# Node.js bindings
|
|
19
|
+
bindings/node/* linguist-generated
|
|
20
|
+
binding.gyp linguist-generated
|
|
21
|
+
package.json linguist-generated
|
|
22
|
+
package-lock.json linguist-generated
|
|
23
|
+
|
|
24
|
+
# Python bindings
|
|
25
|
+
bindings/python/** linguist-generated
|
|
26
|
+
setup.py linguist-generated
|
|
27
|
+
pyproject.toml linguist-generated
|
|
28
|
+
|
|
29
|
+
# Go bindings
|
|
30
|
+
bindings/go/* linguist-generated
|
|
31
|
+
go.mod linguist-generated
|
|
32
|
+
go.sum linguist-generated
|
|
33
|
+
|
|
34
|
+
# Swift bindings
|
|
35
|
+
bindings/swift/** linguist-generated
|
|
36
|
+
Package.swift linguist-generated
|
|
37
|
+
Package.resolved linguist-generated
|
|
38
|
+
|
|
39
|
+
# Zig bindings
|
|
40
|
+
build.zig linguist-generated
|
|
41
|
+
build.zig.zon linguist-generated
|
|
42
|
+
|
|
43
|
+
# Linux start script should use lf
|
|
44
|
+
internal/gradlew text eol=lf
|
|
45
|
+
|
|
46
|
+
# These are Windows script files and should use crlf
|
|
47
|
+
*.bat text eol=crlf
|
|
48
|
+
|
|
49
|
+
# Binary files should be left untouched
|
|
50
|
+
*.jar binary
|
package/CHANGELOG.adoc
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
= Changelog
|
|
2
|
+
|
|
3
|
+
[[release-0.18.0]]
|
|
4
|
+
== 0.18.0 (2024-03-27)
|
|
5
|
+
|
|
6
|
+
This is a large change.
|
|
7
|
+
It changes the parse tree to match other Pkl parsers, and also fixes all known parser issues.
|
|
8
|
+
|
|
9
|
+
=== Additions
|
|
10
|
+
|
|
11
|
+
* Add support for Go bindings (https://github.com/apple/tree-sitter-pkl/pull/33[#33])
|
|
12
|
+
* Add support for Python bindings (https://github.com/apple/tree-sitter-pkl/pull/33[#33])
|
|
13
|
+
|
|
14
|
+
=== Breaking Changes
|
|
15
|
+
|
|
16
|
+
* Minimum tree-sitter version bumped to 0.25 (https://github.com/apple/tree-sitter-pkl/pull/33[#33])
|
|
17
|
+
* Restructure parse tree to match other grammars (https://github.com/apple/tree-sitter-pkl/pull/32[#32], https://github.com/apple/tree-sitter-pkl/pull/34[#34], https://github.com/apple/tree-sitter-pkl/pull/36[#36])
|
|
18
|
+
** Remove `variableExpr`, `propertyCallExpr`, `methodCallExpr`, `objectLiteral`, `variableObjectLiteral`
|
|
19
|
+
** Introduce `unqualifiedAccessExpr`, `qualifiedAccessExpr`
|
|
20
|
+
** Introduce `amendExpr`
|
|
21
|
+
** Remove `_expr2` workaround
|
|
22
|
+
** Split `binaryExpr` into separate parts
|
|
23
|
+
** Merge `readExpr`/`readOrNullExpr`/`readGlobExpr` into `readExpr`
|
|
24
|
+
** Merge `importExpr`/`importOrNullExpr` into `importExpr`
|
|
25
|
+
** Rename `isExpr` to `typeTestExpr`
|
|
26
|
+
** Rename `asExpr` to `typeCastExpr`
|
|
27
|
+
** Rename `objectPredicate` to `memberPredicate`
|
|
28
|
+
** Add blank identifiers (all parameters can optionally use `_` as an identifier, can't use anywhere else)
|
|
29
|
+
** Rename `unionDefaultType` to `defaultUnionType`
|
|
30
|
+
** Suffix all expressions with `Expr`
|
|
31
|
+
*** `nullLiteral` -> `nullLiteralExpr`
|
|
32
|
+
*** `trueLiteral` -> `trueLiteralExpr`
|
|
33
|
+
*** `falseLiteral` -> `falseLiteralExpr`
|
|
34
|
+
*** `intLiteral` -> `intLiteralExpr`
|
|
35
|
+
*** `floatLiteral` -> `floatLiteralExpr`
|
|
36
|
+
*** `slStringLiteral` -> `slStringLiteralExpr`
|
|
37
|
+
*** `mlStringLiteral` -> `mlStringLiteralExpr`
|
|
38
|
+
*** `functionLiteral` -> `functionLiteralExpr`
|
|
39
|
+
** Rename `interpolationExpr` to `stringInterpolation`
|
|
40
|
+
** In `readExpr` and `importExpr`, rename field "keyword" to "variant"
|
|
41
|
+
|
|
42
|
+
=== Fixes
|
|
43
|
+
|
|
44
|
+
* Fix parser issues (https://github.com/apple/tree-sitter-pkl/pull/32[#32], https://github.com/apple/tree-sitter-pkl/pull/34[#34])
|
|
45
|
+
** Fix parsing of unary minus as an object element
|
|
46
|
+
** Fix precedence issues (e.g. make `.` stronger than `+`)
|
|
47
|
+
** Fix scanner producing incorrect tokens in some cases
|
|
48
|
+
** Fix: disallow newline in type constraints between type and first parenthesis
|
|
49
|
+
** Require parentheses around `trace`, `throw`
|
|
50
|
+
|
|
51
|
+
[[release-0.17.0]]
|
|
52
|
+
== 0.17.0 (2024-10-10)
|
|
53
|
+
|
|
54
|
+
=== Breaking changes
|
|
55
|
+
|
|
56
|
+
* Give type nodes explicit names (e.g. `"unknown"` -> `unknownTypeNode`)
|
|
57
|
+
* Remove support for legacy syntax in for and when generators
|
|
58
|
+
|
|
59
|
+
=== Additions
|
|
60
|
+
|
|
61
|
+
* Add support for Swift Package Manager
|
|
62
|
+
* Add support for C bindings
|
|
63
|
+
* Add doc comments to the parse tree
|
|
64
|
+
* Add `slStringLiteralPart` and `mlStringLiteralPart` to the parse tree
|
|
65
|
+
* Add field names to various nodes
|
|
66
|
+
* Add support for shebang comments
|
|
67
|
+
|
|
68
|
+
=== Fixes
|
|
69
|
+
|
|
70
|
+
* Fix parsing of parenthesized expressions in object
|
|
71
|
+
elements
|
|
72
|
+
* Fix parsing of union types with default markers
|
|
73
|
+
* Add missing `else` in when generators
|
|
74
|
+
* Add missing module type
|
|
75
|
+
* Fix parsing of strings that start with two slashes
|
|
76
|
+
|
|
77
|
+
=== Contributors ❤️
|
|
78
|
+
|
|
79
|
+
Thanks to all the contributors for this release!
|
|
80
|
+
|
|
81
|
+
* https://github.com/ObserverOfTime[@ObserverOfTime]
|
|
82
|
+
* https://github.com/jayadamsmorgan[jayadamsmorgan]
|
|
83
|
+
* https://github.com/thomaspurchas[@thomaspurchas]
|
|
84
|
+
|
|
85
|
+
[[release-0.16.0]]
|
|
86
|
+
== 0.16.0 (2024-02-02)
|
|
87
|
+
|
|
88
|
+
Initial release
|
package/CMakeLists.txt
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.13)
|
|
2
|
+
|
|
3
|
+
project(tree-sitter-pkl
|
|
4
|
+
VERSION "0.18.0"
|
|
5
|
+
DESCRIPTION "Parser for Pkl programming language"
|
|
6
|
+
HOMEPAGE_URL "https://github.com/apple/tree-sitter-pkl"
|
|
7
|
+
LANGUAGES C)
|
|
8
|
+
|
|
9
|
+
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
|
|
10
|
+
option(TREE_SITTER_REUSE_ALLOCATOR "Reuse the library allocator" OFF)
|
|
11
|
+
|
|
12
|
+
set(TREE_SITTER_ABI_VERSION 15 CACHE STRING "Tree-sitter ABI version")
|
|
13
|
+
if(NOT ${TREE_SITTER_ABI_VERSION} MATCHES "^[0-9]+$")
|
|
14
|
+
unset(TREE_SITTER_ABI_VERSION CACHE)
|
|
15
|
+
message(FATAL_ERROR "TREE_SITTER_ABI_VERSION must be an integer")
|
|
16
|
+
endif()
|
|
17
|
+
|
|
18
|
+
find_program(TREE_SITTER_CLI tree-sitter DOC "Tree-sitter CLI")
|
|
19
|
+
|
|
20
|
+
add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/src/parser.c"
|
|
21
|
+
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/grammar.json"
|
|
22
|
+
COMMAND "${TREE_SITTER_CLI}" generate src/grammar.json
|
|
23
|
+
--abi=${TREE_SITTER_ABI_VERSION}
|
|
24
|
+
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
25
|
+
COMMENT "Generating parser.c")
|
|
26
|
+
|
|
27
|
+
add_library(tree-sitter-pkl src/parser.c)
|
|
28
|
+
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/scanner.c)
|
|
29
|
+
target_sources(tree-sitter-pkl PRIVATE src/scanner.c)
|
|
30
|
+
endif()
|
|
31
|
+
target_include_directories(tree-sitter-pkl
|
|
32
|
+
PRIVATE src
|
|
33
|
+
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/bindings/c>
|
|
34
|
+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
|
35
|
+
|
|
36
|
+
target_compile_definitions(tree-sitter-pkl PRIVATE
|
|
37
|
+
$<$<BOOL:${TREE_SITTER_REUSE_ALLOCATOR}>:TREE_SITTER_REUSE_ALLOCATOR>
|
|
38
|
+
$<$<CONFIG:Debug>:TREE_SITTER_DEBUG>)
|
|
39
|
+
|
|
40
|
+
set_target_properties(tree-sitter-pkl
|
|
41
|
+
PROPERTIES
|
|
42
|
+
C_STANDARD 11
|
|
43
|
+
POSITION_INDEPENDENT_CODE ON
|
|
44
|
+
SOVERSION "${TREE_SITTER_ABI_VERSION}.${PROJECT_VERSION_MAJOR}"
|
|
45
|
+
DEFINE_SYMBOL "")
|
|
46
|
+
|
|
47
|
+
configure_file(bindings/c/tree-sitter-pkl.pc.in
|
|
48
|
+
"${CMAKE_CURRENT_BINARY_DIR}/tree-sitter-pkl.pc" @ONLY)
|
|
49
|
+
|
|
50
|
+
include(GNUInstallDirs)
|
|
51
|
+
|
|
52
|
+
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bindings/c/tree_sitter"
|
|
53
|
+
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
|
54
|
+
FILES_MATCHING PATTERN "*.h")
|
|
55
|
+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tree-sitter-pkl.pc"
|
|
56
|
+
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig")
|
|
57
|
+
install(TARGETS tree-sitter-pkl
|
|
58
|
+
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
|
59
|
+
|
|
60
|
+
file(GLOB QUERIES queries/*.scm)
|
|
61
|
+
install(FILES ${QUERIES}
|
|
62
|
+
DESTINATION "${CMAKE_INSTALL_DATADIR}/tree-sitter/queries/pkl")
|
|
63
|
+
|
|
64
|
+
add_custom_target(ts-test "${TREE_SITTER_CLI}" test
|
|
65
|
+
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
66
|
+
COMMENT "tree-sitter test")
|
package/Cargo.lock
CHANGED
|
@@ -1,42 +1,36 @@
|
|
|
1
1
|
# This file is automatically @generated by Cargo.
|
|
2
2
|
# It is not intended for manual editing.
|
|
3
|
-
version =
|
|
3
|
+
version = 4
|
|
4
4
|
|
|
5
5
|
[[package]]
|
|
6
6
|
name = "aho-corasick"
|
|
7
|
-
version = "1.1.
|
|
7
|
+
version = "1.1.3"
|
|
8
8
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
-
checksum = "
|
|
9
|
+
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
|
10
10
|
dependencies = [
|
|
11
11
|
"memchr",
|
|
12
12
|
]
|
|
13
13
|
|
|
14
14
|
[[package]]
|
|
15
15
|
name = "cc"
|
|
16
|
-
version = "1.
|
|
16
|
+
version = "1.2.14"
|
|
17
17
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
18
|
-
checksum = "
|
|
18
|
+
checksum = "0c3d1b2e905a3a7b00a6141adb0e4c0bb941d11caf55349d863942a1cc44e3c9"
|
|
19
19
|
dependencies = [
|
|
20
|
-
"
|
|
20
|
+
"shlex",
|
|
21
21
|
]
|
|
22
22
|
|
|
23
|
-
[[package]]
|
|
24
|
-
name = "libc"
|
|
25
|
-
version = "0.2.148"
|
|
26
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
27
|
-
checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b"
|
|
28
|
-
|
|
29
23
|
[[package]]
|
|
30
24
|
name = "memchr"
|
|
31
|
-
version = "2.
|
|
25
|
+
version = "2.7.4"
|
|
32
26
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
33
|
-
checksum = "
|
|
27
|
+
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
|
34
28
|
|
|
35
29
|
[[package]]
|
|
36
30
|
name = "regex"
|
|
37
|
-
version = "1.
|
|
31
|
+
version = "1.11.1"
|
|
38
32
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
39
|
-
checksum = "
|
|
33
|
+
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
|
|
40
34
|
dependencies = [
|
|
41
35
|
"aho-corasick",
|
|
42
36
|
"memchr",
|
|
@@ -46,9 +40,9 @@ dependencies = [
|
|
|
46
40
|
|
|
47
41
|
[[package]]
|
|
48
42
|
name = "regex-automata"
|
|
49
|
-
version = "0.
|
|
43
|
+
version = "0.4.9"
|
|
50
44
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
51
|
-
checksum = "
|
|
45
|
+
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
|
|
52
46
|
dependencies = [
|
|
53
47
|
"aho-corasick",
|
|
54
48
|
"memchr",
|
|
@@ -57,9 +51,15 @@ dependencies = [
|
|
|
57
51
|
|
|
58
52
|
[[package]]
|
|
59
53
|
name = "regex-syntax"
|
|
60
|
-
version = "0.
|
|
54
|
+
version = "0.8.5"
|
|
55
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
56
|
+
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
|
57
|
+
|
|
58
|
+
[[package]]
|
|
59
|
+
name = "shlex"
|
|
60
|
+
version = "1.3.0"
|
|
61
61
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
62
|
-
checksum = "
|
|
62
|
+
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
|
63
63
|
|
|
64
64
|
[[package]]
|
|
65
65
|
name = "tree-sitter"
|
|
@@ -73,7 +73,7 @@ dependencies = [
|
|
|
73
73
|
|
|
74
74
|
[[package]]
|
|
75
75
|
name = "tree-sitter-pkl"
|
|
76
|
-
version = "0.
|
|
76
|
+
version = "0.18.0"
|
|
77
77
|
dependencies = [
|
|
78
78
|
"cc",
|
|
79
79
|
"tree-sitter",
|
package/Cargo.toml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "tree-sitter-pkl"
|
|
3
3
|
description = "Pkl grammar for the tree-sitter parsing library"
|
|
4
|
-
version = "0.
|
|
4
|
+
version = "0.18.0"
|
|
5
5
|
keywords = ["incremental", "parsing", "pkl"]
|
|
6
6
|
categories = ["parsing", "text-editors"]
|
|
7
7
|
repository = "https://github.com/apple/tree-sitter-pkl"
|
package/Makefile
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
ifeq ($(OS),Windows_NT)
|
|
2
|
+
$(error Windows is not supported)
|
|
3
|
+
endif
|
|
4
|
+
|
|
5
|
+
LANGUAGE_NAME := tree-sitter-pkl
|
|
6
|
+
HOMEPAGE_URL := https://github.com/apple/tree-sitter-pkl
|
|
7
|
+
VERSION := 0.18.0
|
|
8
|
+
|
|
9
|
+
# repository
|
|
10
|
+
SRC_DIR := src
|
|
11
|
+
|
|
12
|
+
TS ?= tree-sitter
|
|
13
|
+
|
|
14
|
+
# install directory layout
|
|
15
|
+
PREFIX ?= /usr/local
|
|
16
|
+
DATADIR ?= $(PREFIX)/share
|
|
17
|
+
INCLUDEDIR ?= $(PREFIX)/include
|
|
18
|
+
LIBDIR ?= $(PREFIX)/lib
|
|
19
|
+
PCLIBDIR ?= $(LIBDIR)/pkgconfig
|
|
20
|
+
|
|
21
|
+
# source/object files
|
|
22
|
+
PARSER := $(SRC_DIR)/parser.c
|
|
23
|
+
EXTRAS := $(filter-out $(PARSER),$(wildcard $(SRC_DIR)/*.c))
|
|
24
|
+
OBJS := $(patsubst %.c,%.o,$(PARSER) $(EXTRAS))
|
|
25
|
+
|
|
26
|
+
# flags
|
|
27
|
+
ARFLAGS ?= rcs
|
|
28
|
+
override CFLAGS += -I$(SRC_DIR) -std=c11 -fPIC
|
|
29
|
+
|
|
30
|
+
# ABI versioning
|
|
31
|
+
SONAME_MAJOR = $(shell sed -n 's/\#define LANGUAGE_VERSION //p' $(PARSER))
|
|
32
|
+
SONAME_MINOR = $(word 1,$(subst ., ,$(VERSION)))
|
|
33
|
+
|
|
34
|
+
# OS-specific bits
|
|
35
|
+
ifeq ($(shell uname),Darwin)
|
|
36
|
+
SOEXT = dylib
|
|
37
|
+
SOEXTVER_MAJOR = $(SONAME_MAJOR).$(SOEXT)
|
|
38
|
+
SOEXTVER = $(SONAME_MAJOR).$(SONAME_MINOR).$(SOEXT)
|
|
39
|
+
LINKSHARED = -dynamiclib -Wl,-install_name,$(LIBDIR)/lib$(LANGUAGE_NAME).$(SOEXTVER),-rpath,@executable_path/../Frameworks
|
|
40
|
+
else
|
|
41
|
+
SOEXT = so
|
|
42
|
+
SOEXTVER_MAJOR = $(SOEXT).$(SONAME_MAJOR)
|
|
43
|
+
SOEXTVER = $(SOEXT).$(SONAME_MAJOR).$(SONAME_MINOR)
|
|
44
|
+
LINKSHARED = -shared -Wl,-soname,lib$(LANGUAGE_NAME).$(SOEXTVER)
|
|
45
|
+
endif
|
|
46
|
+
ifneq ($(filter $(shell uname),FreeBSD NetBSD DragonFly),)
|
|
47
|
+
PCLIBDIR := $(PREFIX)/libdata/pkgconfig
|
|
48
|
+
endif
|
|
49
|
+
|
|
50
|
+
all: lib$(LANGUAGE_NAME).a lib$(LANGUAGE_NAME).$(SOEXT) $(LANGUAGE_NAME).pc
|
|
51
|
+
|
|
52
|
+
lib$(LANGUAGE_NAME).a: $(OBJS)
|
|
53
|
+
$(AR) $(ARFLAGS) $@ $^
|
|
54
|
+
|
|
55
|
+
lib$(LANGUAGE_NAME).$(SOEXT): $(OBJS)
|
|
56
|
+
$(CC) $(LDFLAGS) $(LINKSHARED) $^ $(LDLIBS) -o $@
|
|
57
|
+
ifneq ($(STRIP),)
|
|
58
|
+
$(STRIP) $@
|
|
59
|
+
endif
|
|
60
|
+
|
|
61
|
+
$(LANGUAGE_NAME).pc: bindings/c/$(LANGUAGE_NAME).pc.in
|
|
62
|
+
sed -e 's|@PROJECT_VERSION@|$(VERSION)|' \
|
|
63
|
+
-e 's|@CMAKE_INSTALL_LIBDIR@|$(LIBDIR:$(PREFIX)/%=%)|' \
|
|
64
|
+
-e 's|@CMAKE_INSTALL_INCLUDEDIR@|$(INCLUDEDIR:$(PREFIX)/%=%)|' \
|
|
65
|
+
-e 's|@PROJECT_DESCRIPTION@|$(DESCRIPTION)|' \
|
|
66
|
+
-e 's|@PROJECT_HOMEPAGE_URL@|$(HOMEPAGE_URL)|' \
|
|
67
|
+
-e 's|@CMAKE_INSTALL_PREFIX@|$(PREFIX)|' $< > $@
|
|
68
|
+
|
|
69
|
+
$(PARSER): $(SRC_DIR)/grammar.json
|
|
70
|
+
$(TS) generate $^
|
|
71
|
+
|
|
72
|
+
install: all
|
|
73
|
+
install -d '$(DESTDIR)$(DATADIR)'/tree-sitter/queries/pkl '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter '$(DESTDIR)$(PCLIBDIR)' '$(DESTDIR)$(LIBDIR)'
|
|
74
|
+
install -m644 bindings/c/tree_sitter/$(LANGUAGE_NAME).h '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/$(LANGUAGE_NAME).h
|
|
75
|
+
install -m644 $(LANGUAGE_NAME).pc '$(DESTDIR)$(PCLIBDIR)'/$(LANGUAGE_NAME).pc
|
|
76
|
+
install -m644 lib$(LANGUAGE_NAME).a '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).a
|
|
77
|
+
install -m755 lib$(LANGUAGE_NAME).$(SOEXT) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER)
|
|
78
|
+
ln -sf lib$(LANGUAGE_NAME).$(SOEXTVER) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR)
|
|
79
|
+
ln -sf lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXT)
|
|
80
|
+
install -m644 queries/*.scm '$(DESTDIR)$(DATADIR)'/tree-sitter/queries/pkl
|
|
81
|
+
|
|
82
|
+
uninstall:
|
|
83
|
+
$(RM) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).a \
|
|
84
|
+
'$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER) \
|
|
85
|
+
'$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) \
|
|
86
|
+
'$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXT) \
|
|
87
|
+
'$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/$(LANGUAGE_NAME).h \
|
|
88
|
+
'$(DESTDIR)$(PCLIBDIR)'/$(LANGUAGE_NAME).pc
|
|
89
|
+
$(RM) -r '$(DESTDIR)$(DATADIR)'/tree-sitter/queries/pkl
|
|
90
|
+
|
|
91
|
+
clean:
|
|
92
|
+
$(RM) $(OBJS) $(LANGUAGE_NAME).pc lib$(LANGUAGE_NAME).a lib$(LANGUAGE_NAME).$(SOEXT)
|
|
93
|
+
|
|
94
|
+
test:
|
|
95
|
+
$(TS) test
|
|
96
|
+
|
|
97
|
+
.PHONY: all install uninstall clean test
|
package/Package.swift
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// swift-tools-version:5.9
|
|
2
|
+
import PackageDescription
|
|
3
|
+
|
|
4
|
+
let package = Package(
|
|
5
|
+
name: "TreeSitterPkl",
|
|
6
|
+
products: [
|
|
7
|
+
.library(name: "TreeSitterPkl", targets: ["TreeSitterPkl"]),
|
|
8
|
+
],
|
|
9
|
+
dependencies: [],
|
|
10
|
+
targets: [
|
|
11
|
+
.target(name: "TreeSitterPkl",
|
|
12
|
+
path: ".",
|
|
13
|
+
sources: [
|
|
14
|
+
"src/parser.c",
|
|
15
|
+
"src/scanner.c",
|
|
16
|
+
],
|
|
17
|
+
resources: [
|
|
18
|
+
.copy("queries"),
|
|
19
|
+
],
|
|
20
|
+
publicHeadersPath: "bindings/swift",
|
|
21
|
+
cSettings: [.headerSearchPath("src")]
|
|
22
|
+
)
|
|
23
|
+
]
|
|
24
|
+
)
|
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
A tree-sitter grammar for Pkl.
|
|
2
|
+
|
|
3
|
+
# install dependencies
|
|
4
|
+
$ npm install
|
|
5
|
+
|
|
6
|
+
# build parser
|
|
7
|
+
$ npm run build
|
|
8
|
+
|
|
9
|
+
# parse some code
|
|
10
|
+
$ ./node_modules/.bin/tree-sitter parse test.pkl
|
|
11
|
+
|
|
12
|
+
# Tests
|
|
13
|
+
|
|
14
|
+
Tree sitter comes with its own test framework. Files in `test/corpus/`
|
|
15
|
+
describe one test each. All tests in `test/corpus/` are performed by the
|
|
16
|
+
command
|
|
17
|
+
|
|
18
|
+
$ tree-sitter test
|
|
19
|
+
|
|
20
|
+
If the grammar has changed, run `tree-sitter test --update` to update the corpus.
|
|
21
|
+
|
|
22
|
+
## Snippet Tests
|
|
23
|
+
|
|
24
|
+
The tests within [test/corpus/snippetTests](test/corpus/snippetTests) are generated from the core Pkl parser, and are not updated by `tree-sitter test --update`.
|
|
25
|
+
|
|
26
|
+
These tests are generated by running `./gradlew createLanguageSnippetsCorpus`.
|
|
27
|
+
This task grabs all language snippet tests, and renders them into a format that can be processed by tree-sitter.
|
|
28
|
+
|
|
29
|
+
To fix any rendering issues, change [SExprRenderer](buildSrc/src/main/kotlin/SExprRenderer.kt).
|
|
30
|
+
|
|
31
|
+
# Upgrading tree-sitter
|
|
32
|
+
|
|
33
|
+
Upgrading tree-sitter involves upgrading the NPM package.
|
|
34
|
+
|
|
35
|
+
1. Run `npm update tree-sitter` to install the newer version of tree-sitter.
|
|
36
|
+
2. Commit to main, and push.
|
|
37
|
+
|
|
38
|
+
# Resources
|
|
39
|
+
- [Tree-sitter docs](https://tree-sitter.github.io/tree-sitter/)
|
|
40
|
+
- [Guide to your first Tree-sitter grammar](https://gist.github.com/Aerijo/df27228d70c633e088b0591b8857eeef)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#ifndef TREE_SITTER_PKL_H
|
|
2
|
+
#define TREE_SITTER_PKL_H
|
|
3
|
+
|
|
4
|
+
typedef struct TSLanguage TSLanguage;
|
|
5
|
+
|
|
6
|
+
#ifdef __cplusplus
|
|
7
|
+
extern "C" {
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
const TSLanguage *tree_sitter_pkl();
|
|
11
|
+
|
|
12
|
+
#ifdef __cplusplus
|
|
13
|
+
}
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
#endif // TREE_SITTER_PKL_H
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
prefix=@CMAKE_INSTALL_PREFIX@
|
|
2
|
+
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
|
|
3
|
+
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
|
|
4
|
+
|
|
5
|
+
Name: tree-sitter-pkl
|
|
6
|
+
Description: @PROJECT_DESCRIPTION@
|
|
7
|
+
URL: @PROJECT_HOMEPAGE_URL@
|
|
8
|
+
Version: @PROJECT_VERSION@
|
|
9
|
+
Libs: -L${libdir} -ltree-sitter-pkl
|
|
10
|
+
Cflags: -I${includedir}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#ifndef TREE_SITTER_PKL_H_
|
|
2
|
+
#define TREE_SITTER_PKL_H_
|
|
3
|
+
|
|
4
|
+
typedef struct TSLanguage TSLanguage;
|
|
5
|
+
|
|
6
|
+
#ifdef __cplusplus
|
|
7
|
+
extern "C" {
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
const TSLanguage *tree_sitter_pkl(void);
|
|
11
|
+
|
|
12
|
+
#ifdef __cplusplus
|
|
13
|
+
}
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
#endif // TREE_SITTER_PKL_H_
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
package tree_sitter_pkl
|
|
2
|
+
|
|
3
|
+
// #cgo CFLAGS: -std=c11 -fPIC
|
|
4
|
+
// #include "../../src/parser.c"
|
|
5
|
+
// #if __has_include("../../src/scanner.c")
|
|
6
|
+
// #include "../../src/scanner.c"
|
|
7
|
+
// #endif
|
|
8
|
+
import "C"
|
|
9
|
+
|
|
10
|
+
import "unsafe"
|
|
11
|
+
|
|
12
|
+
// Get the tree-sitter Language for this grammar.
|
|
13
|
+
func Language() unsafe.Pointer {
|
|
14
|
+
return unsafe.Pointer(C.tree_sitter_pkl())
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
package tree_sitter_pkl_test
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"testing"
|
|
5
|
+
|
|
6
|
+
tree_sitter "github.com/tree-sitter/go-tree-sitter"
|
|
7
|
+
tree_sitter_pkl "github.com/apple/tree-sitter-pkl/bindings/go"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
func TestCanLoadGrammar(t *testing.T) {
|
|
11
|
+
language := tree_sitter.NewLanguage(tree_sitter_pkl.Language())
|
|
12
|
+
if language == nil {
|
|
13
|
+
t.Errorf("Error loading Pkl grammar")
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
type BaseNode = {
|
|
2
|
+
type: string;
|
|
3
|
+
named: boolean;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
type ChildNode = {
|
|
7
|
+
multiple: boolean;
|
|
8
|
+
required: boolean;
|
|
9
|
+
types: BaseNode[];
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
type NodeInfo =
|
|
13
|
+
| (BaseNode & {
|
|
14
|
+
subtypes: BaseNode[];
|
|
15
|
+
})
|
|
16
|
+
| (BaseNode & {
|
|
17
|
+
fields: { [name: string]: ChildNode };
|
|
18
|
+
children: ChildNode[];
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
type Language = {
|
|
22
|
+
language: unknown;
|
|
23
|
+
nodeTypeInfo: NodeInfo[];
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
declare const language: Language;
|
|
27
|
+
export = language;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from unittest import TestCase
|
|
2
|
+
|
|
3
|
+
import tree_sitter
|
|
4
|
+
import tree_sitter_pkl
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class TestLanguage(TestCase):
|
|
8
|
+
def test_can_load_grammar(self):
|
|
9
|
+
try:
|
|
10
|
+
tree_sitter.Language(tree_sitter_pkl.language())
|
|
11
|
+
except Exception:
|
|
12
|
+
self.fail("Error loading Pkl grammar")
|