commandbox.system.util

Class Parser

lucee.Component
    extended by commandbox.system.util.Parser

Copyright Since 2014 CommandBox by Ortus Solutions, Corp www.coldbox.org | www.ortussolutions.com CommandBox Command Line Parser and Tokenizer

Class Attributes:
  • synchronized : false
  •  
  • accessors : false
  •  
  • persistent : false
  •  
  • author : Brad Wood, Luis Majano, Denny Valliant
  •  
    Property Summary
    type property default serializable required
    any CR


    • access = public
    • returntype = any
    • inject = CR@constants
    true false
    Constructor Summary
    init()
          constructor.
    Method Summary
    string escapeArg([any argValue])
         Escapes a value and for inclusion in a command.
    any markExpressions(any argValue)
         Find any strings encased in backticks and flags them as a CommandBox expression.
    any markSystemSettings(any argValue)
         Find any strings like ${foo} and flag them as a system setting.
    any parseParameters(array parameters, [any commandParameters])
         Parse an array of parameter tokens.
    any removeEscapedChars([any theString])
    any replaceEscapedChars([any theString])
    any tokenizeInput([string line])
         Tokenizes the command line entered by the user.
    any unwrapQuotes([any theString])
     
    Methods inherited from class lucee.Component
    None

    Constructor Detail

    init

    public init()

    constructor


    Property Detail

    CR

    property any CR

    Attributes:
    access - public
    required - false
    returntype - any
    inject - CR@constants
    serializable - true

    Method Detail

    escapeArg

    public string escapeArg([any argValue])

    Escapes a value and for inclusion in a command The following replacements are made: " --> \" ' --> \' ` --> \` = --> \= ; --> \; & --> \& | --> \| ${ --> \${

    Parameters:
    argValue

    markExpressions

    public any markExpressions(any argValue)

    Find any strings encased in backticks and flags them as a CommandBox expression

    Parameters:
    argValue

    markSystemSettings

    public any markSystemSettings(any argValue)

    Find any strings like ${foo} and flag them as a system setting

    Parameters:
    argValue

    parseParameters

    public any parseParameters(array parameters, [any commandParameters])

    Parse an array of parameter tokens. unescape values and determine if named or positional params are being used.

    Parameters:
    parameters
    commandParameters

    removeEscapedChars

    public any removeEscapedChars([any theString])

    Parameters:
    theString

    replaceEscapedChars

    public any replaceEscapedChars([any theString])

    Parameters:
    theString

    tokenizeInput

    public any tokenizeInput([string line])

    Tokenizes the command line entered by the user. Returns array with command statements and arguments Consider making a dedicated CFC for this since some of the logic could benifit from little helper methods to increase readability and reduce duplicate code.

    Parameters:
    line

    unwrapQuotes

    public any unwrapQuotes([any theString])

    Parameters:
    theString