├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
└── workflows
│ └── maven.yml
├── .gitignore
├── CITATION.cff
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── SECURITY.md
├── TODO.md
├── docs
├── CNAME
├── index.html
└── org
│ ├── byteskript
│ ├── index.html
│ └── skript
│ │ ├── api
│ │ ├── Deletable.html
│ │ ├── Document.html
│ │ ├── Event.html
│ │ ├── Flag.html
│ │ ├── HandlerType.html
│ │ ├── LanguageElement.html
│ │ ├── Library.html
│ │ ├── ModifiableLibrary.html
│ │ ├── PropertyHandler.html
│ │ ├── Referent.html
│ │ ├── SyntaxElement.html
│ │ ├── automatic
│ │ │ ├── GeneratedEffect.html
│ │ │ ├── GeneratedEntryNode.html
│ │ │ ├── GeneratedEntrySection.html
│ │ │ ├── GeneratedEventHolder.html
│ │ │ ├── GeneratedExpression.html
│ │ │ └── index.html
│ │ ├── index.html
│ │ ├── note
│ │ │ ├── Documentation.html
│ │ │ ├── Effect.html
│ │ │ ├── EntryNode.html
│ │ │ ├── EntrySection.html
│ │ │ ├── Event.html
│ │ │ ├── EventValue.html
│ │ │ ├── Expression.html
│ │ │ ├── ForceBridge.html
│ │ │ ├── ForceExtract.html
│ │ │ ├── ForceInline.html
│ │ │ ├── Property.html
│ │ │ ├── SkriptType.html
│ │ │ └── index.html
│ │ └── syntax
│ │ │ ├── ComplexExpression.html
│ │ │ ├── Condition.html
│ │ │ ├── ControlEffect.html
│ │ │ ├── Effect.html
│ │ │ ├── Element.html
│ │ │ ├── EventHolder.html
│ │ │ ├── EventValueExpression.html
│ │ │ ├── ExtractedSection.html
│ │ │ ├── InnerModifyExpression.html
│ │ │ ├── Literal.html
│ │ │ ├── Member.html
│ │ │ ├── RelationalExpression.html
│ │ │ ├── Section.html
│ │ │ ├── SectionEntry.html
│ │ │ ├── SimpleEntry.html
│ │ │ ├── SimpleExpression.html
│ │ │ ├── TriggerHolder.html
│ │ │ └── index.html
│ │ ├── index.html
│ │ └── runtime
│ │ ├── Script.html
│ │ ├── Skript$RuntimeClassLoader.html
│ │ ├── Skript$SkriptMirror.html
│ │ ├── Skript.html
│ │ ├── config
│ │ ├── ConfigEntry.html
│ │ ├── ConfigMap.html
│ │ └── index.html
│ │ ├── index.html
│ │ ├── internal
│ │ ├── Bootstrapper.html
│ │ ├── CompiledScript.html
│ │ ├── CompilerDependent.html
│ │ ├── GlobalVariableMap.html
│ │ ├── LibraryClassLoader.html
│ │ ├── Member.html
│ │ ├── Metafactory.html
│ │ ├── ModifiableCompiler.html
│ │ ├── Promise.html
│ │ ├── ThreadSpecific.html
│ │ └── index.html
│ │ ├── threading
│ │ ├── AirlockQueue.html
│ │ ├── OperationController.html
│ │ ├── ScriptExceptionHandler.html
│ │ ├── ScriptFinishFuture.html
│ │ ├── ScriptRunner.html
│ │ ├── ScriptThread.html
│ │ ├── ScriptThreadPoolExecutor.html
│ │ ├── SkriptThreadProvider.html
│ │ └── index.html
│ │ └── type
│ │ ├── AtomicVariable.html
│ │ ├── Converter$Data.html
│ │ ├── Converter.html
│ │ ├── DataList.html
│ │ ├── DataMap.html
│ │ ├── OperatorFunction$Data.html
│ │ ├── OperatorFunction$Type.html
│ │ ├── OperatorFunction.html
│ │ └── index.html
│ └── index.html
├── pom.xml
├── scripts
└── install-byteskript.sh
└── src
├── main
└── java
│ ├── org
│ └── byteskript
│ │ └── skript
│ │ ├── api
│ │ ├── AsyncEvent.java
│ │ ├── DebugTypeMeta.java
│ │ ├── Deletable.java
│ │ ├── Document.java
│ │ ├── Event.java
│ │ ├── Flag.java
│ │ ├── FunctionalEntrySection.java
│ │ ├── HandlerType.java
│ │ ├── LanguageElement.java
│ │ ├── Library.java
│ │ ├── ModifiableLibrary.java
│ │ ├── PropertyHandler.java
│ │ ├── Referent.java
│ │ ├── SyntaxAnnotationUnwrapper.java
│ │ ├── SyntaxElement.java
│ │ ├── automatic
│ │ │ ├── GeneratedEffect.java
│ │ │ ├── GeneratedEntryNode.java
│ │ │ ├── GeneratedEntrySection.java
│ │ │ ├── GeneratedEventHolder.java
│ │ │ └── GeneratedExpression.java
│ │ ├── note
│ │ │ ├── Documentation.java
│ │ │ ├── Effect.java
│ │ │ ├── EntryNode.java
│ │ │ ├── EntrySection.java
│ │ │ ├── Event.java
│ │ │ ├── EventValue.java
│ │ │ ├── Expression.java
│ │ │ ├── ForceBridge.java
│ │ │ ├── ForceExtract.java
│ │ │ ├── ForceInline.java
│ │ │ ├── Property.java
│ │ │ └── SkriptType.java
│ │ └── syntax
│ │ │ ├── ComplexExpression.java
│ │ │ ├── Condition.java
│ │ │ ├── ControlEffect.java
│ │ │ ├── Effect.java
│ │ │ ├── Element.java
│ │ │ ├── EventHolder.java
│ │ │ ├── EventValueExpression.java
│ │ │ ├── ExtractedSection.java
│ │ │ ├── InnerModifyExpression.java
│ │ │ ├── Literal.java
│ │ │ ├── Member.java
│ │ │ ├── RelationalExpression.java
│ │ │ ├── Section.java
│ │ │ ├── SectionEntry.java
│ │ │ ├── SimpleEntry.java
│ │ │ ├── SimpleExpression.java
│ │ │ └── TriggerHolder.java
│ │ ├── app
│ │ ├── ByteSkriptApp.java
│ │ ├── ScriptCompiler.java
│ │ ├── ScriptDebugger.java
│ │ ├── ScriptJarBuilder.java
│ │ ├── ScriptLoader.java
│ │ ├── ScriptRunner.java
│ │ ├── SimpleThrottleController.java
│ │ └── SkriptApp.java
│ │ ├── compiler
│ │ ├── AreaFlag.java
│ │ ├── BasicInlineController.java
│ │ ├── BridgeCompiler.java
│ │ ├── CommonTypes.java
│ │ ├── CompileState.java
│ │ ├── Context.java
│ │ ├── DebugSkriptCompiler.java
│ │ ├── ElementTree.java
│ │ ├── FileContext.java
│ │ ├── InlineController.java
│ │ ├── Pattern.java
│ │ ├── SimpleSkriptCompiler.java
│ │ ├── SkriptCompiler.java
│ │ ├── SkriptLangSpec.java
│ │ ├── SkriptParser.java
│ │ ├── Unit.java
│ │ └── structure
│ │ │ ├── BasicTree.java
│ │ │ ├── ErrorDetails.java
│ │ │ ├── ExtractionTree.java
│ │ │ ├── Frame.java
│ │ │ ├── Function.java
│ │ │ ├── IfElseTree.java
│ │ │ ├── LoopTree.java
│ │ │ ├── MonitorTree.java
│ │ │ ├── MultiLabel.java
│ │ │ ├── PreVariable.java
│ │ │ ├── ProgrammaticSplitTree.java
│ │ │ ├── PropertyAccessGenerator.java
│ │ │ ├── SectionMeta.java
│ │ │ ├── SyntaxTree.java
│ │ │ ├── TestTree.java
│ │ │ ├── TriggerTree.java
│ │ │ ├── TryCatchTree.java
│ │ │ ├── VerifyTree.java
│ │ │ └── WhileTree.java
│ │ ├── error
│ │ ├── ScriptAssertionError.java
│ │ ├── ScriptBootstrapError.java
│ │ ├── ScriptCompileError.java
│ │ ├── ScriptError.java
│ │ ├── ScriptLibraryError.java
│ │ ├── ScriptLoadError.java
│ │ ├── ScriptParseError.java
│ │ ├── ScriptReassemblyError.java
│ │ └── ScriptRuntimeError.java
│ │ ├── lang
│ │ ├── element
│ │ │ └── StandardElements.java
│ │ ├── handler
│ │ │ └── StandardHandlers.java
│ │ └── syntax
│ │ │ ├── comparison
│ │ │ ├── ExprContains.java
│ │ │ ├── ExprExists.java
│ │ │ ├── ExprGT.java
│ │ │ ├── ExprGTEQ.java
│ │ │ ├── ExprIsArray.java
│ │ │ ├── ExprIsEqual.java
│ │ │ ├── ExprIsOfType.java
│ │ │ ├── ExprLT.java
│ │ │ ├── ExprLTEQ.java
│ │ │ ├── ExprMatches.java
│ │ │ └── ExprNotEqual.java
│ │ │ ├── config
│ │ │ ├── EffectSaveConfig.java
│ │ │ ├── ExprConfigFileSection.java
│ │ │ ├── ExprKeyInConfig.java
│ │ │ └── ExprNewConfig.java
│ │ │ ├── control
│ │ │ ├── EffectAdd.java
│ │ │ ├── EffectDelete.java
│ │ │ ├── EffectRemove.java
│ │ │ └── EffectSet.java
│ │ │ ├── dictionary
│ │ │ ├── EffectImportFunction.java
│ │ │ ├── EffectImportType.java
│ │ │ ├── EffectUseLibrary.java
│ │ │ └── MemberDictionary.java
│ │ │ ├── entry
│ │ │ ├── EntryExtends.java
│ │ │ ├── EntryParameters.java
│ │ │ ├── EntryReturn.java
│ │ │ ├── EntryTemplate.java
│ │ │ ├── EntryTriggerSection.java
│ │ │ ├── EntryVerifySection.java
│ │ │ └── syntax
│ │ │ │ ├── EntrySyntax.java
│ │ │ │ ├── EntrySyntaxEffect.java
│ │ │ │ ├── EntrySyntaxExpression.java
│ │ │ │ ├── EntrySyntaxMode.java
│ │ │ │ ├── EntrySyntaxProperty.java
│ │ │ │ └── ICreateSyntax.java
│ │ │ ├── event
│ │ │ ├── EventAnyLoad.java
│ │ │ ├── EventLoad.java
│ │ │ ├── EventUnload.java
│ │ │ └── ExprCurrentEvent.java
│ │ │ ├── flow
│ │ │ ├── EffectAssert.java
│ │ │ ├── EffectAssertWithError.java
│ │ │ ├── EffectBreak.java
│ │ │ ├── EffectBreakIf.java
│ │ │ ├── EffectBreakLoop.java
│ │ │ ├── EffectContinue.java
│ │ │ ├── EffectExit.java
│ │ │ ├── EffectExitThread.java
│ │ │ ├── EffectReturn.java
│ │ │ ├── EffectStop.java
│ │ │ ├── conditional
│ │ │ │ ├── ElseIfSection.java
│ │ │ │ ├── ElseSection.java
│ │ │ │ └── IfSection.java
│ │ │ ├── error
│ │ │ │ ├── CatchSection.java
│ │ │ │ ├── EffectTry.java
│ │ │ │ └── TrySection.java
│ │ │ ├── execute
│ │ │ │ ├── EffectMonitorSection.java
│ │ │ │ ├── EffectRun.java
│ │ │ │ ├── EffectRunAsync.java
│ │ │ │ ├── EffectRunWith.java
│ │ │ │ ├── EffectRunWithAsync.java
│ │ │ │ ├── EffectWaitFor.java
│ │ │ │ └── ExprResult.java
│ │ │ ├── lambda
│ │ │ │ ├── ExprLemmaSection.java
│ │ │ │ ├── ExprRunnableSection.java
│ │ │ │ └── ExprSupplierSection.java
│ │ │ └── loop
│ │ │ │ ├── EffectLoopInSection.java
│ │ │ │ ├── EffectLoopTimesSection.java
│ │ │ │ └── EffectWhileSection.java
│ │ │ ├── function
│ │ │ ├── ExprFunction.java
│ │ │ ├── ExprFunctionDynamic.java
│ │ │ ├── ExprFunctionExternal.java
│ │ │ ├── ExprFunctionNoArgs.java
│ │ │ ├── ExprFunctionProperty.java
│ │ │ ├── MemberFunction.java
│ │ │ └── MemberFunctionNoArgs.java
│ │ │ ├── generic
│ │ │ ├── EffectPrint.java
│ │ │ ├── ExprBinaryOtherwise.java
│ │ │ ├── ExprBracket.java
│ │ │ ├── ExprConverter.java
│ │ │ ├── ExprJavaVersion.java
│ │ │ ├── ExprNewLine.java
│ │ │ ├── ExprProperty.java
│ │ │ ├── ExprSystemInput.java
│ │ │ ├── ExprSystemProperty.java
│ │ │ └── ExprTernaryOtherwise.java
│ │ │ ├── list
│ │ │ ├── EffectClearList.java
│ │ │ ├── ExprIndexOfList.java
│ │ │ ├── ExprNewArray.java
│ │ │ ├── ExprNewList.java
│ │ │ └── ExprSizeOfList.java
│ │ │ ├── literal
│ │ │ ├── BooleanLiteral.java
│ │ │ ├── DoubleLiteral.java
│ │ │ ├── FloatLiteral.java
│ │ │ ├── IntegerLiteral.java
│ │ │ ├── LongLiteral.java
│ │ │ ├── NoneLiteral.java
│ │ │ ├── RegexLiteral.java
│ │ │ └── StringLiteral.java
│ │ │ ├── map
│ │ │ ├── ExprKeyInMap.java
│ │ │ └── ExprNewMap.java
│ │ │ ├── maths
│ │ │ ├── ExprAdd.java
│ │ │ ├── ExprDivide.java
│ │ │ ├── ExprMultiply.java
│ │ │ ├── ExprSquareRoot.java
│ │ │ ├── ExprSubtract.java
│ │ │ └── SymbolJoiner.java
│ │ │ ├── script
│ │ │ ├── EffectLoadScript.java
│ │ │ ├── EffectUnloadScript.java
│ │ │ ├── ExprCompiler.java
│ │ │ ├── ExprCurrentScript.java
│ │ │ └── ExprLoadedScripts.java
│ │ │ ├── test
│ │ │ └── EffectTest.java
│ │ │ ├── timing
│ │ │ ├── EffectSleep.java
│ │ │ ├── EffectWait.java
│ │ │ ├── EffectWake.java
│ │ │ ├── ExprDays.java
│ │ │ ├── ExprHours.java
│ │ │ ├── ExprMilliseconds.java
│ │ │ ├── ExprMinutes.java
│ │ │ ├── ExprMonths.java
│ │ │ ├── ExprSeconds.java
│ │ │ ├── ExprThread.java
│ │ │ ├── ExprWeeks.java
│ │ │ ├── ExprYears.java
│ │ │ └── MemberEvery.java
│ │ │ ├── type
│ │ │ ├── ExprNewType.java
│ │ │ ├── ExprThisThing.java
│ │ │ ├── ExprType.java
│ │ │ ├── MemberTemplateType.java
│ │ │ ├── MemberType.java
│ │ │ └── property
│ │ │ │ ├── EntryFinal.java
│ │ │ │ ├── EntryLocal.java
│ │ │ │ ├── EntryProperty.java
│ │ │ │ └── EntryType.java
│ │ │ └── variable
│ │ │ ├── ExprVariable.java
│ │ │ ├── ExprVariableAtomic.java
│ │ │ ├── ExprVariableGlobal.java
│ │ │ └── ExprVariableThread.java
│ │ └── runtime
│ │ ├── Script.java
│ │ ├── Skript.java
│ │ ├── UnsafeAccessor.java
│ │ ├── config
│ │ ├── ConfigEntry.java
│ │ └── ConfigMap.java
│ │ ├── data
│ │ ├── EventData.java
│ │ ├── Function.java
│ │ ├── HandlerData.java
│ │ ├── PeriodicalData.java
│ │ ├── ScriptData.java
│ │ ├── SourceData.java
│ │ ├── Structure.java
│ │ └── TypeData.java
│ │ ├── event
│ │ ├── Empty.java
│ │ ├── Load.java
│ │ └── Unload.java
│ │ ├── internal
│ │ ├── Bootstrapper.java
│ │ ├── CompiledScript.java
│ │ ├── CompilerDependent.java
│ │ ├── ConsoleColour.java
│ │ ├── EventHandler.java
│ │ ├── ExtractedSyntaxCalls.java
│ │ ├── GlobalVariableMap.java
│ │ ├── IOHandlers.java
│ │ ├── Instruction.java
│ │ ├── InvokingScriptRunner.java
│ │ ├── LibraryClassLoader.java
│ │ ├── Member.java
│ │ ├── Metafactory.java
│ │ ├── ModifiableCompiler.java
│ │ ├── OperatorHandler.java
│ │ ├── Promise.java
│ │ ├── ScriptClassLoader.java
│ │ ├── ThreadSpecific.java
│ │ ├── ThreadVariableMap.java
│ │ ├── VariableMap.java
│ │ ├── WeakList.java
│ │ └── package-info.java
│ │ ├── threading
│ │ ├── AirlockQueue.java
│ │ ├── OperationController.java
│ │ ├── ScriptExceptionHandler.java
│ │ ├── ScriptFinishFuture.java
│ │ ├── ScriptRunner.java
│ │ ├── ScriptThread.java
│ │ ├── ScriptThreadPoolExecutor.java
│ │ └── SkriptThreadProvider.java
│ │ └── type
│ │ ├── AtomicVariable.java
│ │ ├── Converter.java
│ │ ├── DataList.java
│ │ ├── DataMap.java
│ │ ├── EventData.java
│ │ ├── Executable.java
│ │ ├── OperatorFunction.java
│ │ └── Query.java
│ ├── skript.java
│ └── unsafe.java
└── test
├── java
└── org
│ └── byteskript
│ └── skript
│ └── test
│ ├── AsyncCompileTest.java
│ ├── ConfigTest.java
│ ├── CreatePages.java
│ ├── ExampleController.java
│ ├── MainTest.java
│ ├── RecompileTest.java
│ ├── SkriptTest.java
│ ├── SyntaxTest.java
│ ├── SyntaxTreeTest.java
│ ├── TestingLibrary.java
│ └── ThreadingTest.java
└── resources
├── main.bsk
└── tests
├── addeffect.bsk
├── anyloadevent.bsk
├── asserteffect.bsk
├── atomicvariable.bsk
├── binaryotherwise.bsk
├── bracket.bsk
├── breakeffect.bsk
├── breakifeffect.bsk
├── breakloopeffect.bsk
├── clearlist.bsk
├── compiler.bsk
├── configcreator.bsk
├── configfile.bsk
├── contains.bsk
├── continueeffect.bsk
├── conversion.bsk
├── currentevent.bsk
├── currentscript.bsk
├── customsyntax.bsk
├── deleteeffect.bsk
├── dictionary.bsk
├── dynamicfunction.bsk
├── every.bsk
├── exists.bsk
├── extends.bsk
├── externalfunction.bsk
├── finalmember.bsk
├── functionexpression.bsk
├── functionmember.bsk
├── globalvariable.bsk
├── greaterthan.bsk
├── greaterthanequalto.bsk
├── if.bsk
├── implicitarray.bsk
├── importfunction.bsk
├── importtype.bsk
├── indexinlist.bsk
├── io.bsk
├── isarray.bsk
├── isequal.bsk
├── isoftype.bsk
├── javaversion.bsk
├── keyinconfig.bsk
├── keyinmap.bsk
├── lemma.bsk
├── lessthan.bsk
├── lessthanequalto.bsk
├── literals.bsk
├── loadedscripts.bsk
├── loadevent.bsk
├── loadscript.bsk
├── localmember.bsk
├── localvariable.bsk
├── loopin.bsk
├── looptimes.bsk
├── matches.bsk
├── maths.bsk
├── monitor.bsk
├── namespaceskript.bsk
├── newline.bsk
├── notequal.bsk
├── parameters.bsk
├── print.bsk
├── properties.bsk
├── propertyfunction.bsk
├── propertymember.bsk
├── removeeffect.bsk
├── resultof.bsk
├── returneffect.bsk
├── returntype.bsk
├── run.bsk
├── runasync.bsk
├── runnable.bsk
├── runwith.bsk
├── runwithasync.bsk
├── saveconfig.bsk
├── seteffect.bsk
├── sizeoflist.bsk
├── sleep.bsk
├── supplier.bsk
├── systemproperty.bsk
├── template.bsk
├── templatetype.bsk
├── ternaryotherwise.bsk
├── testeffect.bsk
├── threadexpression.bsk
├── threadvariable.bsk
├── timespans.bsk
├── trigger.bsk
├── trycatch.bsk
├── tryeffect.bsk
├── typecreator.bsk
├── typemember.bsk
├── unloadscript.bsk
├── verify.bsk
├── waitfor.bsk
├── wake.bsk
└── while.bsk
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. iOS]
28 | - Browser [e.g. chrome, safari]
29 | - Version [e.g. 22]
30 |
31 | **Smartphone (please complete the following information):**
32 | - Device: [e.g. iPhone6]
33 | - OS: [e.g. iOS8.1]
34 | - Browser [e.g. stock browser, safari]
35 | - Version [e.g. 22]
36 |
37 | **Additional context**
38 | Add any other context about the problem here.
39 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.github/workflows/maven.yml:
--------------------------------------------------------------------------------
1 | name: Run Tests
2 | on:
3 | push:
4 | paths-ignore:
5 | - '**.md'
6 | - '**.yml'
7 | jobs:
8 | run_tests:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - name: Checkout the repository
12 | uses: actions/checkout@v2
13 | - name: Set up JDK 17
14 | uses: actions/setup-java@v1
15 | with:
16 | java-version: 17
17 | - name: Cache Maven packages
18 | uses: actions/cache@v2
19 | with:
20 | path: ~/.m2
21 | key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
22 | restore-keys: ${{ runner.os }}-m2
23 | - name: Run tests with Maven
24 | run: mvn -B test --file pom.xml
25 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Project exclude paths
2 | /target/
3 | .DS_Store
4 | *.class
5 | .idea/
6 |
--------------------------------------------------------------------------------
/CITATION.cff:
--------------------------------------------------------------------------------
1 | cff-version: 1.2.0
2 | message: "If you use this software, please cite it as below."
3 | authors:
4 | - family-names: "Scott"
5 | given-names: "Mackenzie"
6 | - family-names: "Suhonen"
7 | given-names: "Ilari"
8 | title: "ByteSkript"
9 | version: 1.0.0
10 | date-released: 2021-12-25
11 | url: "https://github.com/Moderocky/ByteSkript"
12 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | Please see the contributing guidelines and
4 | guide [here](https://docs.byteskript.org/tutorials/contributing-to-byteskript).
5 |
6 | Please also refer to the contributors
7 | licensing [instructions](https://docs.byteskript.org/readme/licence-information#contributing-to-byteskript).
8 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2021 Moderocky
2 |
3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4 |
5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6 |
7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8 |
9 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 |
13 | You acknowledge that this software is not designed, licensed or intended for use in the design, construction, operation or maintenance of any nuclear facility.
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ByteSkript
2 |
3 | ### Opus #11
4 |
5 | An experimental language based on Skript (with no pre-eminent DSL dependencies) compiled to JVM bytecode.
6 |
7 | ## Visit the documentation and wiki [here](https://docs.byteskript.org).
8 |
9 | ## Get the latest compiler release [here](https://github.com/Moderocky/ByteSkript/releases).
10 |
11 | ByteSkript draws heavily from the original [Skript](https://github.com/SkriptLang/Skript/) language design, with some
12 | minor structural adaptations to strengthen the language grammar, to remove some unnecessary jargon and make the language
13 | more reliable. ByteSkript also increases interoperability with existing JVM languages.
14 |
15 | **ByteSkript is not affiliated with [SkriptLang](https://github.com/SkriptLang/Skript/).**
16 |
17 | ByteSkript is a completely **new** implementation of the general guide and style of the 'Skript' language, with its own
18 | language specification, goals and licence.
19 |
20 | ## Libraries Used
21 |
22 | * [ObjectWeb ASM](https://asm.ow2.io) \
23 | A bytecode-assembling library used internally by the Java JDK.\
24 | Used for compiling complex syntax.
25 | * [Mirror](https://github.com/Moderocky/Mirror) \
26 | An on-the-fly member access compiler, alternative to Java reflection.\
27 | Used for compiling dynamic method handles at runtime.
28 | * [Foundation](https://github.com/Moderocky/Foundation) \
29 | A class-building framework to simplify method creation.\
30 | Used for compiling simple syntax.
31 | * [Jupiter](https://github.com/Moderocky/Jupiter) \
32 | An I/O-based library for buffers and memory management.\
33 | Used for lazy-iteration and efficient data disposal.
34 | * [AutoDocs](https://github.com/Moderocky/AutoDocs) \
35 | A web-documentation generator.\
36 | Used for generating the [API docs](https://apidocs.byteskript.org/org/byteskript/skript/).
37 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security Policy
2 |
3 | ## Supported Versions
4 |
5 | Security vulnerabilities will be retroactively patched on the last **three** medium versions (1.**X**.0).
6 | This will require users to redownload (or rebuild) the affected version.
7 |
8 | ## Reporting a Vulnerability
9 |
10 | For minor vulnerabilities, issues can be made on the GitHub.
11 | For more serious vulnerabilites, please make direct private contact with any organisation member.
12 |
--------------------------------------------------------------------------------
/TODO.md:
--------------------------------------------------------------------------------
1 | # Tasks to Complete
2 |
3 | This file contains a list of tasks that need completing, ordered by various factors.
4 |
5 | Contributors can consider this a 'bounty' list of things to do. If you are looking to contribute, consider picking a
6 | task from this list.
7 |
8 | Tasks are categorised by importance and marked by difficulty.
9 |
10 | ### Most Important
11 |
12 | - Finish documentation for built-in syntax. \
13 | Some syntax is missing proper [documentation](https://moderocky.gitbook.io/byteskript/). \
14 | Difficulty: trivial
15 | - Write more comprehensive tests. \
16 | It is important to test all expected behaviour - some syntax are missing full tests. \
17 | It is also important to test forbidden behaviour does *not* work, and proper negative tests are not implemented yet. \
18 | It would also be nice to stress-test complex and difficult-to-parse syntax structures. \
19 | Difficulty: easy
20 |
21 | ### Medium Importance
22 |
23 | - Create a library for Java GUIs. \
24 | This will probably need to interact with JavaFX. \
25 | This should be handled by somebody with experience using Java front-end. \
26 | Difficulty: medium
27 | - Write a better default parser. \
28 | The current parser uses RegEx for assembling patterns. \
29 | Since the matching is trivial, I think these can be converted to string-matches. \
30 | Difficulty: easy
31 |
32 | ### Least Important
33 |
34 | - Create a library for web-servers. \
35 | Support opening a web-server and receiving requests. \
36 | Support sending HTTP requests to a web-server. \
37 | Difficulty: medium
38 | - Create a library for Discord bots. \
39 | Difficulty: easy
40 |
--------------------------------------------------------------------------------
/docs/CNAME:
--------------------------------------------------------------------------------
1 | apidocs.byteskript.org
--------------------------------------------------------------------------------
/scripts/install-byteskript.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | current_dir=$(pwd)
4 | script_dir=$(dirname "$0")
5 |
6 | cd $script_dir
7 | if [[ ! -e bin ]]; then
8 | mkdir "bin"
9 | cd "bin"
10 |
11 | echo $'#!/bin/bash\njava -jar '$script_dir'/ByteSkript.jar $@' > "bsk"
12 | fi
13 |
14 | if [[ ! -e /usr/local/bin/bsk ]]; then
15 | rm /usr/local/bin/bsk
16 | fi
17 |
18 | ln -s $script_dir"/bin/bsk" "/usr/local/bin/bsk"
19 |
20 | chmod a+x $script_dir"/bin/bsk"
21 | chmod a+x /usr/local/bin/bsk
22 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/AsyncEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api;
8 |
9 | import mx.kenzie.autodoc.api.note.Ignore;
10 |
11 | @Ignore
12 | public abstract class AsyncEvent extends Event {
13 |
14 | @Override
15 | public final boolean isAsync() {
16 | return true;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/DebugTypeMeta.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api;
8 |
9 | import mx.kenzie.foundation.Type;
10 |
11 | import java.util.Objects;
12 |
13 | public interface DebugTypeMeta {
14 |
15 | default String debug(Object meta) {
16 | if (meta instanceof Type type) return type.getSimpleName();
17 | return Objects.toString(meta);
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/Deletable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api;
8 |
9 | /**
10 | * Something that can be deleted, and should be compiled as normal to handle the effect.
11 | */
12 | public interface Deletable {
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/Document.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api;
8 |
9 | import mx.kenzie.autodoc.api.note.Description;
10 |
11 | @Description("A miniature record for holding documentation for a syntax element.")
12 | public record Document(String name, String type, String[] patterns, String description, String... examples) {
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/Flag.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api;
8 |
9 | import mx.kenzie.autodoc.api.note.Description;
10 |
11 | @Description("""
12 | Compiler flags to provide trivial information to the matcher.
13 | This should be implemented by an enum.
14 | """)
15 | public interface Flag {
16 |
17 | String name();
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/FunctionalEntrySection.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api;
8 |
9 | import mx.kenzie.autodoc.api.note.Ignore;
10 | import org.byteskript.skript.compiler.Context;
11 |
12 | @Ignore
13 | public interface FunctionalEntrySection {
14 |
15 | void compile(Context context) throws Throwable;
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/HandlerType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api;
8 |
9 | import mx.kenzie.autodoc.api.note.Description;
10 |
11 | @Description("""
12 | A handler mode for interacting with expressions.
13 | The defaults (get/set/add/delete/...) are detailed in StandardHandlers.
14 |
15 | Special implementations could add behaviour like COMPARE_AND_SWAP or GET_ATOMIC.
16 | """)
17 | public interface HandlerType {
18 |
19 | String name();
20 |
21 | boolean expectInputs();
22 |
23 | boolean expectReturn();
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/LanguageElement.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api;
8 |
9 | import mx.kenzie.autodoc.api.note.Description;
10 | import org.byteskript.skript.lang.element.StandardElements;
11 |
12 | /**
13 | * Language elements. For advanced use only.
14 | * See {@link StandardElements} for the built-in ones.
15 | */
16 | @Description("""
17 | Language elements. For advanced use only.
18 | This is designed for adding entirely new pieces of grammar to the language.
19 |
20 | See StandardElements for the built-in ones that most syntax must use.
21 | """)
22 | public interface LanguageElement {
23 |
24 | String name();
25 |
26 | Library getProvider();
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/PropertyHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api;
8 |
9 | import mx.kenzie.autodoc.api.note.Description;
10 | import mx.kenzie.autodoc.api.note.Example;
11 | import mx.kenzie.foundation.Type;
12 |
13 | import java.lang.reflect.Method;
14 | import java.lang.reflect.Modifier;
15 |
16 | @Description("""
17 | A property handler.
18 | """)
19 | public record PropertyHandler(String name, HandlerType type, Type holder, Type value, Method method) {
20 |
21 | @Example("""
22 | new PropertyHandler(StandardHandlers.GET, method, "name");
23 | """)
24 | public PropertyHandler(HandlerType type, Method method, String name) {
25 | this(name, type, createHolder(method), createValue(type, method), method);
26 | }
27 |
28 | private static Type createHolder(Method method) {
29 | if (Modifier.isStatic(method.getModifiers())) {
30 | final Class>[] classes = method.getParameterTypes();
31 | assert classes.length > 0;
32 | return new Type(classes[0]);
33 | } else {
34 | return new Type(method.getDeclaringClass());
35 | }
36 | }
37 |
38 | private static Type createValue(HandlerType type, Method method) {
39 | if (type.expectInputs()) {
40 | final Class>[] classes = method.getParameterTypes();
41 | assert classes.length > 0;
42 | return new Type(classes[classes.length - 1]);
43 | } else if (type.expectReturn()) {
44 | return new Type(method.getReturnType());
45 | } else {
46 | return new Type(void.class);
47 | }
48 | }
49 |
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/Referent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api;
8 |
9 | import mx.kenzie.autodoc.api.note.Description;
10 | import mx.kenzie.foundation.MethodBuilder;
11 | import mx.kenzie.foundation.Type;
12 | import mx.kenzie.foundation.compiler.State;
13 | import org.byteskript.skript.compiler.CompileState;
14 | import org.byteskript.skript.compiler.Context;
15 | import org.byteskript.skript.compiler.Pattern;
16 | import org.byteskript.skript.error.ScriptCompileError;
17 | import org.byteskript.skript.lang.handler.StandardHandlers;
18 |
19 | import java.lang.reflect.Method;
20 |
21 | @Description("This syntax is designed to be set or altered in some way.")
22 | public interface Referent extends SyntaxElement {
23 |
24 | Type getHolderType();
25 |
26 | @Override
27 | default void compile(Context context, Pattern.Match match) throws Throwable {
28 | final MethodBuilder method = context.getMethod();
29 | assert method != null;
30 | final Method target = getHandler(StandardHandlers.GET);
31 | if (target == null) throw new ScriptCompileError(context.lineNumber(), "Referent has no get handler.");
32 | if (target.getReturnType() == void.class)
33 | throw new ScriptCompileError(context.lineNumber(), "Referent get handler must not have a void return.");
34 | this.writeCall(context.getMethod(), target, context);
35 | context.setState(CompileState.STATEMENT);
36 | }
37 |
38 | @Override
39 | default boolean allowedIn(State state, Context context) {
40 | return state == CompileState.STATEMENT && context.hasCurrentUnit();
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/automatic/GeneratedEffect.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.automatic;
8 |
9 | import mx.kenzie.foundation.MethodBuilder;
10 | import mx.kenzie.foundation.WriteInstruction;
11 | import org.byteskript.skript.api.Library;
12 | import org.byteskript.skript.api.syntax.Effect;
13 | import org.byteskript.skript.compiler.CompileState;
14 | import org.byteskript.skript.compiler.Context;
15 | import org.byteskript.skript.compiler.Pattern;
16 | import org.byteskript.skript.lang.element.StandardElements;
17 |
18 | import java.lang.reflect.Method;
19 |
20 | public final class GeneratedEffect extends Effect {
21 |
22 | private final Method target;
23 |
24 | public GeneratedEffect(Library provider, final Method target, String... patterns) {
25 | super(provider, StandardElements.EFFECT, patterns);
26 | this.target = target;
27 | }
28 |
29 | @Override
30 | public void compile(Context context, Pattern.Match match) throws Throwable {
31 | final MethodBuilder method = context.getMethod();
32 | this.writeCall(method, target, context);
33 | if (target.getReturnType() != void.class) method.writeCode(WriteInstruction.pop());
34 | context.setState(CompileState.CODE_BODY);
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/automatic/GeneratedEventHolder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.automatic;
8 |
9 | import org.byteskript.skript.api.Event;
10 | import org.byteskript.skript.api.Library;
11 | import org.byteskript.skript.api.syntax.EventHolder;
12 |
13 | public final class GeneratedEventHolder extends EventHolder {
14 |
15 | private final Class extends Event> owner;
16 |
17 | public GeneratedEventHolder(Library provider, Class extends Event> owner, String... patterns) {
18 | super(provider, patterns);
19 | this.owner = owner;
20 | }
21 |
22 | @Override
23 | public Class extends Event> eventClass() {
24 | return owner;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/automatic/GeneratedExpression.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.automatic;
8 |
9 | import mx.kenzie.foundation.MethodBuilder;
10 | import mx.kenzie.foundation.Type;
11 | import org.byteskript.skript.api.Library;
12 | import org.byteskript.skript.api.syntax.SimpleExpression;
13 | import org.byteskript.skript.compiler.CompileState;
14 | import org.byteskript.skript.compiler.Context;
15 | import org.byteskript.skript.compiler.Pattern;
16 | import org.byteskript.skript.lang.element.StandardElements;
17 |
18 | import java.lang.reflect.Method;
19 |
20 | public final class GeneratedExpression extends SimpleExpression {
21 |
22 | private final Method target;
23 | private final Type value;
24 |
25 | public GeneratedExpression(Library provider, final Method target, String... patterns) {
26 | super(provider, StandardElements.EXPRESSION, patterns);
27 | this.target = target;
28 | this.value = new Type(target.getReturnType());
29 | }
30 |
31 | @Override
32 | public Type getReturnType() {
33 | return value;
34 | }
35 |
36 | @Override
37 | public void compile(Context context, Pattern.Match match) throws Throwable {
38 | final MethodBuilder method = context.getMethod();
39 | assert target.getReturnType() != void.class;
40 | this.writeCall(method, target, context);
41 | context.setState(CompileState.STATEMENT);
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/note/Documentation.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.note;
8 |
9 | import java.lang.annotation.Retention;
10 | import java.lang.annotation.RetentionPolicy;
11 |
12 | @Retention(RetentionPolicy.RUNTIME)
13 | public @interface Documentation {
14 |
15 | String name() default "";
16 |
17 | String description() default "";
18 |
19 | String[] examples() default {};
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/note/Effect.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.note;
8 |
9 | import java.lang.annotation.ElementType;
10 | import java.lang.annotation.Retention;
11 | import java.lang.annotation.RetentionPolicy;
12 | import java.lang.annotation.Target;
13 |
14 | @Target(ElementType.METHOD)
15 | @Retention(RetentionPolicy.RUNTIME)
16 | public @interface Effect {
17 |
18 | String[] value();
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/note/EntryNode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.note;
8 |
9 | import java.lang.annotation.ElementType;
10 | import java.lang.annotation.Retention;
11 | import java.lang.annotation.RetentionPolicy;
12 | import java.lang.annotation.Target;
13 |
14 | @Target({ElementType.RECORD_COMPONENT, ElementType.METHOD})
15 | @Retention(RetentionPolicy.RUNTIME)
16 | public @interface EntryNode {
17 |
18 | String[] value();
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/note/EntrySection.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.note;
8 |
9 | import java.lang.annotation.ElementType;
10 | import java.lang.annotation.Retention;
11 | import java.lang.annotation.RetentionPolicy;
12 | import java.lang.annotation.Target;
13 |
14 | @Target({ElementType.TYPE})
15 | @Retention(RetentionPolicy.RUNTIME)
16 | public @interface EntrySection {
17 |
18 | String[] value();
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/note/Event.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.note;
8 |
9 | import java.lang.annotation.ElementType;
10 | import java.lang.annotation.Retention;
11 | import java.lang.annotation.RetentionPolicy;
12 | import java.lang.annotation.Target;
13 |
14 | @Target(ElementType.TYPE)
15 | @Retention(RetentionPolicy.RUNTIME)
16 | public @interface Event {
17 |
18 | String[] value();
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/note/EventValue.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.note;
8 |
9 | import java.lang.annotation.ElementType;
10 | import java.lang.annotation.Retention;
11 | import java.lang.annotation.RetentionPolicy;
12 | import java.lang.annotation.Target;
13 |
14 | @Target(ElementType.METHOD)
15 | @Retention(RetentionPolicy.RUNTIME)
16 | public @interface EventValue {
17 |
18 | String value();
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/note/Expression.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.note;
8 |
9 | import java.lang.annotation.ElementType;
10 | import java.lang.annotation.Retention;
11 | import java.lang.annotation.RetentionPolicy;
12 | import java.lang.annotation.Target;
13 |
14 | @Target(ElementType.METHOD)
15 | @Retention(RetentionPolicy.RUNTIME)
16 | public @interface Expression {
17 |
18 | String[] value();
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/note/ForceBridge.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.note;
8 |
9 | import java.lang.annotation.ElementType;
10 | import java.lang.annotation.Retention;
11 | import java.lang.annotation.RetentionPolicy;
12 | import java.lang.annotation.Target;
13 |
14 | /**
15 | * Forces a method's raw bytecode to be extracted into the compiled class.
16 | * This should be used sparingly. It is natively unsafe.
17 | */
18 | @Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
19 | @Retention(RetentionPolicy.RUNTIME)
20 | public @interface ForceBridge {
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/note/ForceExtract.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.note;
8 |
9 | import java.lang.annotation.ElementType;
10 | import java.lang.annotation.Retention;
11 | import java.lang.annotation.RetentionPolicy;
12 | import java.lang.annotation.Target;
13 |
14 | /**
15 | * Forces a method's raw bytecode to be extracted into the compiled class.
16 | * This should be used sparingly. It is natively unsafe.
17 | */
18 | @Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
19 | @Retention(RetentionPolicy.RUNTIME)
20 | public @interface ForceExtract {
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/note/ForceInline.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.note;
8 |
9 | import java.lang.annotation.ElementType;
10 | import java.lang.annotation.Retention;
11 | import java.lang.annotation.RetentionPolicy;
12 | import java.lang.annotation.Target;
13 |
14 | /**
15 | * Forces a method's raw bytecode to be written into all compilation targets.
16 | * This should be used sparingly. It is natively unsafe.
17 | */
18 | @Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
19 | @Retention(RetentionPolicy.RUNTIME)
20 | public @interface ForceInline {
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/note/Property.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.note;
8 |
9 | import org.byteskript.skript.lang.handler.StandardHandlers;
10 |
11 | import java.lang.annotation.ElementType;
12 | import java.lang.annotation.Retention;
13 | import java.lang.annotation.RetentionPolicy;
14 | import java.lang.annotation.Target;
15 |
16 | @Target(ElementType.METHOD)
17 | @Retention(RetentionPolicy.RUNTIME)
18 | public @interface Property {
19 |
20 | String value();
21 |
22 | StandardHandlers type() default StandardHandlers.GET;
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/note/SkriptType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.note;
8 |
9 | import java.lang.annotation.ElementType;
10 | import java.lang.annotation.Retention;
11 | import java.lang.annotation.RetentionPolicy;
12 | import java.lang.annotation.Target;
13 |
14 | @Target(ElementType.TYPE)
15 | @Retention(RetentionPolicy.RUNTIME)
16 | public @interface SkriptType {
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/syntax/ComplexExpression.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.syntax;
8 |
9 | import mx.kenzie.foundation.compiler.State;
10 | import org.byteskript.skript.api.LanguageElement;
11 | import org.byteskript.skript.api.Library;
12 | import org.byteskript.skript.api.SyntaxElement;
13 | import org.byteskript.skript.compiler.CompileState;
14 | import org.byteskript.skript.compiler.Context;
15 | import org.byteskript.skript.compiler.Pattern;
16 |
17 | import java.lang.reflect.Method;
18 |
19 | public abstract class ComplexExpression extends Element implements SyntaxElement {
20 |
21 | public ComplexExpression(final Library provider, final LanguageElement type, final String... patterns) {
22 | super(provider, type, patterns);
23 | }
24 |
25 | @Override
26 | public void preCompile(Context context, Pattern.Match match) throws Throwable {
27 | super.preCompile(context, match);
28 | final Method target = handlers.get(context.getHandlerMode());
29 | if (target == null) return;
30 | this.prepareExpectedTypes(context, target);
31 | }
32 |
33 | @Override
34 | public boolean allowedIn(State state, Context context) {
35 | return state == CompileState.STATEMENT && context.hasCurrentUnit();
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/syntax/Condition.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.syntax;
8 |
9 | import org.byteskript.skript.api.LanguageElement;
10 | import org.byteskript.skript.api.Library;
11 | import org.byteskript.skript.api.SyntaxElement;
12 | import org.byteskript.skript.lang.handler.StandardHandlers;
13 |
14 | public abstract class Condition extends Element implements SyntaxElement {
15 |
16 | public Condition(final Library provider, final LanguageElement type, final String... patterns) {
17 | super(provider, type, patterns);
18 | try {
19 | handlers.put(StandardHandlers.FIND, this.getClass().getMethod("find", Object[].class));
20 | } catch (NoSuchMethodException e) {
21 | e.printStackTrace();
22 | }
23 | }
24 |
25 | public abstract Object find(Object... delta);
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/syntax/ControlEffect.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.syntax;
8 |
9 | import org.byteskript.skript.api.HandlerType;
10 | import org.byteskript.skript.api.LanguageElement;
11 | import org.byteskript.skript.api.Library;
12 | import org.byteskript.skript.compiler.Context;
13 | import org.byteskript.skript.compiler.Pattern;
14 |
15 | public abstract class ControlEffect extends Effect {
16 | public ControlEffect(Library provider, LanguageElement type, String... patterns) {
17 | super(provider, type, patterns);
18 | }
19 |
20 | public abstract HandlerType getType(Context context, Pattern.Match match);
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/syntax/InnerModifyExpression.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.syntax;
8 |
9 | import mx.kenzie.foundation.compiler.State;
10 | import org.byteskript.skript.api.LanguageElement;
11 | import org.byteskript.skript.api.Library;
12 | import org.byteskript.skript.api.SyntaxElement;
13 | import org.byteskript.skript.compiler.CompileState;
14 | import org.byteskript.skript.compiler.Context;
15 | import org.byteskript.skript.compiler.Pattern;
16 |
17 | /**
18 | * A special variety of expression designed as a placeholder to modify or contain an inner expression
19 | * and not to be present in the output tree.
20 | *
21 | * Designed for brackets, etc.
22 | */
23 | public abstract class InnerModifyExpression extends Element implements SyntaxElement {
24 |
25 | public InnerModifyExpression(final Library provider, final LanguageElement type, final String... patterns) {
26 | super(provider, type, patterns);
27 | }
28 |
29 | @Override
30 | public final void compile(Context context, Pattern.Match match) {
31 | }
32 |
33 | @Override
34 | public boolean allowedIn(State state, Context context) {
35 | return state == CompileState.STATEMENT && context.hasCurrentUnit();
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/syntax/Literal.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.syntax;
8 |
9 | import mx.kenzie.foundation.MethodBuilder;
10 | import mx.kenzie.foundation.WriteInstruction;
11 | import mx.kenzie.foundation.compiler.State;
12 | import org.byteskript.skript.api.LanguageElement;
13 | import org.byteskript.skript.api.Library;
14 | import org.byteskript.skript.api.SyntaxElement;
15 | import org.byteskript.skript.compiler.CompileState;
16 | import org.byteskript.skript.compiler.Context;
17 | import org.byteskript.skript.compiler.Pattern;
18 | import org.byteskript.skript.lang.handler.StandardHandlers;
19 |
20 | import java.lang.reflect.Method;
21 |
22 | public abstract class Literal extends Element implements SyntaxElement {
23 |
24 | public Literal(final Library provider, final LanguageElement type, final String... patterns) {
25 | super(provider, type, patterns);
26 | }
27 |
28 | @Override
29 | public void compile(Context context, Pattern.Match match) throws Throwable {
30 | final MethodBuilder method = context.getMethod();
31 | assert method != null;
32 | final Method target = handlers.get(StandardHandlers.GET);
33 | assert target != null;
34 | assert target.getReturnType() != void.class;
35 | this.writeCall(method, target, context);
36 | final mx.kenzie.foundation.Type type = context.getCompileCurrent().wanted;
37 | if (type != null) method.writeCode(WriteInstruction.cast(type));
38 | }
39 |
40 | @Override
41 | public boolean allowedIn(State state, Context context) {
42 | return
43 | (state == CompileState.STATEMENT || state == CompileState.ENTRY_VALUE); // remove unit check
44 | }
45 |
46 | public abstract Type parse(String input);
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/syntax/Member.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.syntax;
8 |
9 | import mx.kenzie.foundation.Type;
10 | import org.byteskript.skript.api.LanguageElement;
11 | import org.byteskript.skript.api.Library;
12 | import org.byteskript.skript.compiler.CommonTypes;
13 | import org.byteskript.skript.compiler.CompileState;
14 | import org.byteskript.skript.compiler.Context;
15 | import org.byteskript.skript.compiler.structure.SectionMeta;
16 |
17 | public abstract class Member extends Section {
18 | public Member(Library provider, LanguageElement type, String... patterns) {
19 | super(provider, type, patterns);
20 | }
21 |
22 | @Override
23 | public LanguageElement getType() {
24 | return super.getType();
25 | }
26 |
27 | @Override
28 | public void onSectionExit(Context context, SectionMeta meta) {
29 | context.emptyVariables();
30 | context.setMethod(null, true);
31 | context.setField(null);
32 | context.setState(CompileState.ROOT);
33 | }
34 |
35 | @Override
36 | public boolean allowAsInputFor(Type type) {
37 | return false;
38 | }
39 |
40 | @Override
41 | public Type getReturnType() {
42 | return CommonTypes.VOID;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/syntax/Section.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.syntax;
8 |
9 | import mx.kenzie.foundation.Type;
10 | import org.byteskript.skript.api.LanguageElement;
11 | import org.byteskript.skript.api.Library;
12 | import org.byteskript.skript.compiler.Context;
13 | import org.byteskript.skript.compiler.Pattern;
14 | import org.byteskript.skript.compiler.structure.SectionMeta;
15 | import org.byteskript.skript.error.ScriptCompileError;
16 |
17 | public abstract class Section extends Element {
18 | public Section(Library provider, LanguageElement type, String... patterns) {
19 | super(provider, type, patterns);
20 | }
21 |
22 |
23 | public abstract void onSectionExit(Context context, SectionMeta meta);
24 |
25 | public void compileInline(Context context, Pattern.Match match) throws Throwable {
26 | throw new ScriptCompileError(context.lineNumber(), "'" + name() + "' must be used as a section-header.");
27 | }
28 |
29 | public void preCompileInline(Context context, Pattern.Match match) throws Throwable {
30 | // Rarely used
31 | }
32 |
33 | @Override
34 | public boolean allowAsInputFor(Type type) {
35 | return false;
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/syntax/SectionEntry.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.syntax;
8 |
9 | import mx.kenzie.foundation.Type;
10 | import mx.kenzie.foundation.compiler.State;
11 | import org.byteskript.skript.api.LanguageElement;
12 | import org.byteskript.skript.api.Library;
13 | import org.byteskript.skript.compiler.CommonTypes;
14 | import org.byteskript.skript.compiler.CompileState;
15 | import org.byteskript.skript.compiler.Context;
16 |
17 | public abstract class SectionEntry extends Section {
18 | public SectionEntry(Library provider, LanguageElement type, String... patterns) {
19 | super(provider, type, patterns);
20 | }
21 |
22 | @Override
23 | public CompileState getSubState() {
24 | return CompileState.MEMBER_BODY;
25 | }
26 |
27 | @Override
28 | public Type getReturnType() {
29 | return CommonTypes.VOID;
30 | }
31 |
32 | @Override
33 | public boolean allowedIn(State state, Context context) {
34 | return state == CompileState.MEMBER_BODY;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/syntax/SimpleEntry.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.syntax;
8 |
9 | import mx.kenzie.foundation.Type;
10 | import mx.kenzie.foundation.compiler.State;
11 | import org.byteskript.skript.api.DebugTypeMeta;
12 | import org.byteskript.skript.api.LanguageElement;
13 | import org.byteskript.skript.api.Library;
14 | import org.byteskript.skript.compiler.CommonTypes;
15 | import org.byteskript.skript.compiler.CompileState;
16 | import org.byteskript.skript.compiler.Context;
17 | import org.byteskript.skript.compiler.Pattern;
18 |
19 | public abstract class SimpleEntry extends Element implements DebugTypeMeta {
20 | public SimpleEntry(Library provider, LanguageElement type, String... patterns) {
21 | super(provider, type, patterns);
22 | }
23 |
24 | @Override
25 | public Pattern.Match match(String thing, Context context) {
26 | return super.match(thing, context);
27 | }
28 |
29 | @Override
30 | public CompileState getSubState() {
31 | return CompileState.MEMBER_BODY;
32 | }
33 |
34 | @Override
35 | public boolean allowAsInputFor(Type type) {
36 | return false;
37 | }
38 |
39 | @Override
40 | public Type getReturnType() {
41 | return CommonTypes.VOID;
42 | }
43 |
44 | @Override
45 | public boolean allowedIn(State state, Context context) {
46 | return state == CompileState.MEMBER_BODY;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/api/syntax/TriggerHolder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.api.syntax;
8 |
9 | import mx.kenzie.foundation.MethodBuilder;
10 | import mx.kenzie.foundation.Type;
11 | import org.byteskript.skript.api.LanguageElement;
12 | import org.byteskript.skript.api.Library;
13 | import org.byteskript.skript.compiler.CompileState;
14 | import org.byteskript.skript.compiler.Context;
15 | import org.byteskript.skript.compiler.Pattern;
16 |
17 | import java.lang.reflect.Modifier;
18 | import java.util.regex.Matcher;
19 |
20 | public abstract class TriggerHolder extends Member {
21 | public TriggerHolder(Library provider, LanguageElement type, String... patterns) {
22 | super(provider, type, patterns);
23 | }
24 |
25 | @Override
26 | public void compile(Context context, Pattern.Match match) {
27 | final MethodBuilder method = context.getBuilder()
28 | .addMethod(callSiteName(context, match))
29 | .addModifiers(Modifier.STATIC)
30 | .setReturnType(returnType(context, match))
31 | .addParameter(parameters(context, match.matcher()));
32 | context.setMethod(method, true);
33 | context.setState(CompileState.MEMBER_BODY);
34 | }
35 |
36 | public abstract String callSiteName(Context context, Pattern.Match match);
37 |
38 | public abstract Type returnType(Context context, Pattern.Match match);
39 |
40 | public Type[] parameters(Context context, Matcher match) {
41 | return new Type[0];
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/app/ScriptCompiler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.app;
8 |
9 | import org.byteskript.skript.runtime.Skript;
10 |
11 | import java.io.IOException;
12 |
13 | public final class ScriptCompiler extends SkriptApp {
14 | private static final Skript SKRIPT = new Skript();
15 |
16 | public static void main(String... args) throws IOException {
17 | registerLibraries(SKRIPT);
18 | SKRIPT.compileScripts(SOURCE, OUTPUT);
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/app/ScriptDebugger.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.app;
8 |
9 | import mx.kenzie.jupiter.stream.Stream;
10 | import org.byteskript.skript.compiler.DebugSkriptCompiler;
11 | import org.byteskript.skript.runtime.Skript;
12 |
13 | import java.io.File;
14 | import java.io.FileInputStream;
15 | import java.io.FileOutputStream;
16 | import java.io.IOException;
17 |
18 | public class ScriptDebugger extends SkriptApp {
19 |
20 | public static void main(String... args) throws IOException {
21 | final File file = new File(ROOT, "debug.txt");
22 | try (final FileOutputStream stream = new FileOutputStream(file)) {
23 | final Skript skript = new Skript(new DebugSkriptCompiler(Stream.controller(stream)));
24 | registerLibraries(skript);
25 | skript.compileScripts(SOURCE);
26 | }
27 | }
28 |
29 | public static void debug(File file) throws IOException {
30 | final File debug = new File(ROOT, "debug.txt");
31 | try (final FileOutputStream stream = new FileOutputStream(debug)) {
32 | try (final FileInputStream input = new FileInputStream(file)) {
33 | final Skript skript = new Skript(new DebugSkriptCompiler(Stream.controller(stream)));
34 | registerLibraries(skript);
35 | skript.compileScript(input, "skript/" + file.getName());
36 | }
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/app/ScriptLoader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.app;
8 |
9 | import org.byteskript.skript.runtime.Skript;
10 |
11 | import java.io.IOException;
12 |
13 | public final class ScriptLoader extends SkriptApp {
14 | private static final Skript SKRIPT = new Skript();
15 |
16 | public static void main(String... args) throws IOException {
17 | registerLibraries(SKRIPT);
18 | SKRIPT.compileLoadScripts(SOURCE);
19 | new SimpleThrottleController(SKRIPT).run();
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/app/SimpleThrottleController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.app;
8 |
9 | import org.byteskript.skript.runtime.Skript;
10 | import org.byteskript.skript.runtime.internal.Instruction;
11 | import org.byteskript.skript.runtime.threading.AirlockQueue;
12 | import org.byteskript.skript.runtime.threading.OperationController;
13 |
14 | public record SimpleThrottleController(Skript skript) implements Runnable {
15 |
16 | @Override
17 | public void run() {
18 | while (true) {
19 | for (final OperationController process : skript.getProcesses()) {
20 | final AirlockQueue queue;
21 | synchronized (queue = process.getQueue()) {
22 | if (queue.isEmpty()) continue;
23 | for (Instruction> runnable : queue) {
24 | try {
25 | runnable.run();
26 | } catch (Throwable e) {
27 | e.printStackTrace();
28 | }
29 | }
30 | queue.clear();
31 | }
32 | synchronized (process) {
33 | process.notifyAll();
34 | }
35 | }
36 | try {
37 | Thread.sleep(10);
38 | } catch (InterruptedException e) {
39 | e.printStackTrace();
40 | break;
41 | }
42 | }
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/compiler/AreaFlag.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.compiler;
8 |
9 | import org.byteskript.skript.api.Flag;
10 |
11 | public enum AreaFlag implements Flag {
12 | IN_SYNTAX,
13 | IN_FUNCTION,
14 | IN_VERIFIER,
15 | IN_TRIGGER,
16 | IN_PROPERTY,
17 | IN_TYPE,
18 | IN_ABSTRACT_TYPE,
19 | IN_EVENT,
20 | IN_DICTIONARY
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/compiler/CompileState.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.compiler;
8 |
9 | import mx.kenzie.foundation.compiler.State;
10 |
11 | public enum CompileState implements State {
12 | ROOT,
13 | MEMBER_BODY,
14 | CODE_BODY,
15 | STATEMENT,
16 | ENTRY_VALUE,
17 | IMPORT_BODY,
18 | AREA_BODY,
19 | HEADER
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/compiler/SkriptParser.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.compiler;
8 |
9 | import mx.kenzie.foundation.Type;
10 | import org.byteskript.skript.compiler.structure.ErrorDetails;
11 |
12 | public interface SkriptParser {
13 |
14 | ElementTree parseLine(final String line, final FileContext context);
15 |
16 | ElementTree assembleStatement(final String statement, final FileContext context, final ErrorDetails details);
17 |
18 | ElementTree assembleExpression(String expression, final Type expected, final FileContext context, final ErrorDetails details);
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/compiler/Unit.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.compiler;
8 |
9 | import org.byteskript.skript.api.LanguageElement;
10 |
11 | public record Unit(LanguageElement type) {
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/compiler/structure/BasicTree.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.compiler.structure;
8 |
9 | import org.byteskript.skript.api.SyntaxElement;
10 | import org.byteskript.skript.compiler.Context;
11 |
12 | public abstract class BasicTree extends ProgrammaticSplitTree {
13 |
14 | private final SectionMeta owner;
15 | private final MultiLabel end;
16 |
17 | public BasicTree(SectionMeta owner) {
18 | this.owner = owner;
19 | this.end = new MultiLabel();
20 | }
21 |
22 | @Override
23 | public SectionMeta owner() {
24 | return owner;
25 | }
26 |
27 | @Override
28 | public MultiLabel getEnd() {
29 | return end;
30 | }
31 |
32 | @Override
33 | public void start(Context context) {
34 |
35 | }
36 |
37 | @Override
38 | public void branch(Context context) {
39 |
40 | }
41 |
42 | @Override
43 | public void close(Context context) {
44 | if (end.uses.size() > 0)
45 | context.getMethod().writeCode(end.instruction());
46 | context.removeTree(this);
47 | }
48 |
49 | @Override
50 | public boolean permit(SyntaxElement element) {
51 | return false;
52 | }
53 |
54 | @Override
55 | public boolean isOpen() {
56 | return false;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/compiler/structure/ErrorDetails.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.compiler.structure;
8 |
9 | import org.byteskript.skript.api.SyntaxElement;
10 |
11 | import java.util.HashMap;
12 | import java.util.Map;
13 |
14 | public class ErrorDetails {
15 |
16 | public final Map hints = new HashMap<>();
17 | public String file;
18 | public String line;
19 | public SyntaxElement lineMatched;
20 | public String expression;
21 | public SyntaxElement expressionMatched;
22 |
23 | public void addHint(SyntaxElement source, String hint) {
24 | hints.put(source, hint);
25 | }
26 |
27 | @Override
28 | public ErrorDetails clone() {
29 | final ErrorDetails details = new ErrorDetails();
30 | details.file = file;
31 | details.line = line;
32 | details.lineMatched = lineMatched;
33 | details.expression = expression;
34 | details.expressionMatched = expressionMatched;
35 | details.hints.putAll(hints);
36 | return details;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/compiler/structure/Frame.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.compiler.structure;
8 |
9 | import mx.kenzie.foundation.Type;
10 |
11 | public interface Frame {
12 |
13 | int size();
14 |
15 | void add(Type... types);
16 |
17 | void remove(Type... types);
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/main/java/org/byteskript/skript/compiler/structure/MultiLabel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 ByteSkript org (Moderocky)
3 | * View the full licence information and permissions:
4 | * https://github.com/Moderocky/ByteSkript/blob/master/LICENSE
5 | */
6 |
7 | package org.byteskript.skript.compiler.structure;
8 |
9 | import mx.kenzie.foundation.WriteInstruction;
10 | import org.objectweb.asm.Label;
11 |
12 | import java.util.ArrayList;
13 | import java.util.List;
14 |
15 | public class MultiLabel {
16 |
17 | protected final List