类 DSL

java.lang.Object
com.tlcsdm.core.dsl.DSL

public class DSL extends Object
Represents the data portion of the DSL.

This class is used to configure and start the DSL Runtime.

从以下版本开始:
Jan, 17th, 2017
作者:
Konloch
  • 字段详细资料

    • setValueDelimiter

      private final String setValueDelimiter
    • variableDelimiter

      private final char variableDelimiter
    • bracketDelimiterStart

      private final String bracketDelimiterStart
    • bracketDelimiterEnd

      private final String bracketDelimiterEnd
    • subscriptDelimiterStart

      private final String subscriptDelimiterStart
    • subscriptDelimiterEnd

      private final String subscriptDelimiterEnd
    • commentDelimiter

      private final String commentDelimiter
    • strictMode

      private final boolean strictMode
    • commands

      private final HashMap<String,DSLDefinedCommand> commands
    • subscripts

      private final HashMap<String,List<DSLRuntimeCommand>> subscripts
    • runtime

      private final DSLRuntime runtime
  • 构造器详细资料

    • DSL

      public DSL(char setValueDelimiter, char variableDelimiter, char bracketDelimiterStart, char bracketDelimiterEnd, char subscriptDelimiterStart, char subscriptDelimiterEnd, char commentDelimiter)
      Constructs a new DSL instance with strict mode disabled by default.
      参数:
      setValueDelimiter - any character to represent the variable value delimiter
      variableDelimiter - any character to represent the variable delimiter
      bracketDelimiterStart - any character to represent the bracket delimiter start
      bracketDelimiterEnd - any character to represent the bracket delimiter end
      subscriptDelimiterStart - any character to represent the subscript delimiter start
      subscriptDelimiterEnd - any character to represent the subscript delimiter end
      commentDelimiter - any character to represent the comment delimiter
    • DSL

      public DSL(char setValueDelimiter, char variableDelimiter, char bracketDelimiterStart, char bracketDelimiterEnd, char subscriptDelimiterStart, char subscriptDelimiterEnd, char commentDelimiter, boolean strictMode)
      Constructs a new DSL instance.
      参数:
      setValueDelimiter - any character to represent the variable value delimiter
      variableDelimiter - any character to represent the variable delimiter
      bracketDelimiterStart - any character to represent the bracket delimiter start
      bracketDelimiterEnd - any character to represent the bracket delimiter end
      subscriptDelimiterStart - any character to represent the subscript delimiter start
      subscriptDelimiterEnd - any character to represent the subscript delimiter end
      commentDelimiter - any character to represent the comment delimiter
      strictMode - true for strict mode to be enabled
  • 方法详细资料

    • clear

      public DSL clear()
      Clear all the user defined commands and subscripts. It also removes all runtime data.
      返回:
      this instance for method chaining
    • parse

      public DSL parse(File file) throws IOException
      Parse any File and execute / load the script.
      参数:
      file - any file
      返回:
      this instance for method chaining
      抛出:
      IOException - if an I/O error occurs reading from the stream
    • parse

      public DSL parse(ArrayList<String> fileContents)
      Parse any String ArrayList and execute / load the script.
      参数:
      fileContents - any String ArrayList
      返回:
      this instance for method chaining
    • addVar

      public DSL addVar(String name, VariableRunnable variableRunnable)
      Add a new variable handler.
      参数:
      name - any String as the variable name
      variableRunnable - any VariableRunnable to be called when the variable set value gets called
      返回:
      this instance for method chaining
    • removeVar

      public DSL removeVar(String name)
      Remove a variable handler.
      参数:
      name - any String as the variable name
      返回:
      this instance for method chaining
    • addFunc

      public DSL addFunc(String name, FunctionRunnable functionRunnable)
      Add a new function handler.
      参数:
      name - any String as the function name
      functionRunnable - any FunctionRunnable to be called when the function gets called
      返回:
      this instance for method chaining
    • removeFunc

      public DSL removeFunc(String name)
      Remove a function handler.
      参数:
      name - any String as the function name
      返回:
      this instance for method chaining
    • addSub

      public DSL addSub(String name)
      Define a subscript.
      参数:
      name - any String as the subscript name
      返回:
      this instance for method chaining
    • removeSub

      public DSL removeSub(String name)
      Remove a subscript.
      参数:
      name - any String as the subscript name
      返回:
      this instance for method chaining
    • run

      public DSL run(String name)
      Runs a subscript associated with a String name. Throws a Runtime Exception if the Subscript doesn't exist.
      参数:
      name - any String as the subscript name
      返回:
      this instance for method chaining
    • getSetValueDelimiter

      public String getSetValueDelimiter()
      Returns the set value delimiter
      返回:
      the set value delimiter as a String
    • getBracketDelimiterStart

      public String getBracketDelimiterStart()
      Returns the bracket delimiter start
      返回:
      the bracket delimiter start as a String
    • getBracketDelimiterEnd

      public String getBracketDelimiterEnd()
      Returns the bracket delimiter end
      返回:
      the bracket delimiter end as a String
    • getSubscriptDelimiterStart

      public String getSubscriptDelimiterStart()
      Returns the subscript delimiter start
      返回:
      the subscript delimiter start as a String
    • getSubscriptDelimiterEnd

      public String getSubscriptDelimiterEnd()
      Returns the subscript delimiter end
      返回:
      the subscript delimiter end as a String
    • getVariableDelimiter

      public char getVariableDelimiter()
      Returns the variable delimiter
      返回:
      the variable delimiter as a String
    • getCommentDelimiter

      public String getCommentDelimiter()
      Returns the comment delimiter
      返回:
      the comment delimiter as a String
    • isStrictMode

      public boolean isStrictMode()
      Returns the strict mode flag
      返回:
      if true strict mode will be enabled during runtime parsing
    • getCommands

      public HashMap<String,DSLDefinedCommand> getCommands()
      Returns the command map
      返回:
      the command map as a HashMap
    • getSubscripts

      public HashMap<String,List<DSLRuntimeCommand>> getSubscripts()
      The subscript map
      返回:
      the subscript map as a HashMap
    • getRuntime

      public DSLRuntime getRuntime()
      The DLSRuntime associated with this DSL.
      返回:
      the DSLRuntime for this DSL instance