Libraries.Data.Formats.JavaScriptObjectNotationListener Documentation

This class is an implementation of the JavaScriptObjectNotationListener blueprint class used by the parser to perform actions when certain parse events occur.

Example Code

use Libraries.Data.Formats.JavaScriptObjectNotationListener
use Libraries.Data.Formats.JavaScriptObjectNotationDefaultListener

class JavaScriptObjectNotationDefaultListener is JavaScriptObjectNotationListener

e

Inherits from: Libraries.Language.Object

Summary

Actions Summary Table

ActionsDescription
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
EnterArray()This method is called by the JavaScriptObjectNotationParser on an EnterArray event.
EnterObject()This method is called by the JavaScriptObjectNotationParser on an EnterObject event.
EnterPair()This method is called by the JavaScriptObjectNotationParser on an EnterPair event.
EnterStart()This method is called by the JavaScriptObjectNotationParser on an EnterStart event.
EnterValue()This method is called by the JavaScriptObjectNotationParser on an EnterStart event.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
ExitArray()This method is called by the JavaScriptObjectNotationParser on an ExitArray event.
ExitObject()This method is called by the JavaScriptObjectNotationParser on an ExitObject event.
ExitPair()This method is called by the JavaScriptObjectNotationParser on an ExitPair event.
ExitStart()This method is called by the JavaScriptObjectNotationParser on an ExitStart event.
ExitValue()This method is called by the JavaScriptObjectNotationParser on an EnterStart event.
GetHashCode()This action gets the hash code for an object.
VisitError(Libraries.Data.Formats.JavaScriptObjectNotationError error)This method is called by the JavaScriptObjectNotationParser to visit a text object.
VisitFalse(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)This method is called by the JavaScriptObjectNotationParser to visit a text object.
VisitInteger(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)This method is called by the JavaScriptObjectNotationParser to visit a text object.
VisitNumber(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)This method is called by the JavaScriptObjectNotationParser to visit a text object.
VisitText(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)This method is called by the JavaScriptObjectNotationParser to visit a text object.
VisitTrue(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)This method is called by the JavaScriptObjectNotationParser to visit a text object.
VisitUndefined(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)This method is called by the JavaScriptObjectNotationParser to visit a text object.

Actions Documentation

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Example Code

Object o
        Object t
        integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smalle

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

EnterArray()

This method is called by the JavaScriptObjectNotationParser on an EnterArray event.

Example Code

use Libraries.Data.Formats.JavaScriptObjectNotationListener

    private action EnterArray
        JavaScriptObjectNotationListener listener
        listener:EnterArray()
    e

EnterObject()

This method is called by the JavaScriptObjectNotationParser on an EnterObject event.

Example Code

use Libraries.Data.Formats.JavaScriptObjectNotationListener

    private action EnterObject
        JavaScriptObjectNotationListener listener
        listener:EnterObject()
    e

EnterPair()

This method is called by the JavaScriptObjectNotationParser on an EnterPair event.

Example Code

use Libraries.Data.Formats.JavaScriptObjectNotationListener

    private action EnterPair
        JavaScriptObjectNotationListener listener
        listener:EnterPair()
    e

EnterStart()

This method is called by the JavaScriptObjectNotationParser on an EnterStart event.

Example Code

use Libraries.Data.Formats.JavaScriptObjectNotationListener

    private action EnterStart
        JavaScriptObjectNotationListener listener
        listener:EnterStart()
    e

EnterValue()

This method is called by the JavaScriptObjectNotationParser on an EnterStart event.

Example Code

use Libraries.Data.Formats.JavaScriptObjectNotationListener

    private action EnterStart
        JavaScriptObjectNotationListener listener
        listener:ExitStart()
    e

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

ExitArray()

This method is called by the JavaScriptObjectNotationParser on an ExitArray event.

Example Code

use Libraries.Data.Formats.JavaScriptObjectNotationListener

    private action ExitArray
        JavaScriptObjectNotationListener listener
        listener:ExitArray()
    e

ExitObject()

This method is called by the JavaScriptObjectNotationParser on an ExitObject event.

Example Code

use Libraries.Data.Formats.JavaScriptObjectNotationListener

    private action ExitObject
        JavaScriptObjectNotationListener listener
        listener:ExitObject()
    e

ExitPair()

This method is called by the JavaScriptObjectNotationParser on an ExitPair event.

Example Code

use Libraries.Data.Formats.JavaScriptObjectNotationListener

    private action ExitPair
        JavaScriptObjectNotationListener listener
        listener:ExitPair()
    e

ExitStart()

This method is called by the JavaScriptObjectNotationParser on an ExitStart event.

Example Code

use Libraries.Data.Formats.JavaScriptObjectNotationListener

    private action EnterStart
        JavaScriptObjectNotationListener listener
        listener:ExitStart()
    e

ExitValue()

This method is called by the JavaScriptObjectNotationParser on an EnterStart event.

Example Code

use Libraries.Data.Formats.JavaScriptObjectNotationListener

    private action EnterStart
        JavaScriptObjectNotationListener listener
        listener:ExitStart()
    e

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode

Return

integer: The integer hash code of the object.

VisitError(Libraries.Data.Formats.JavaScriptObjectNotationError error)

This method is called by the JavaScriptObjectNotationParser to visit a text object.

Example Code

use Libraries.Data.Formats.JavaScriptObjectNotationListener
    use Libraries.Data.Formats.JavaScriptObjectNotationTerminal
    use Libraries.Data.Formats.JavaScriptObjectNotationToken
    use Libraries.Data.Formats.JavaScriptObjectNotationLexer

    private action ThrowError(JavaScriptObjectNotationToken start, text message, JavaScriptObjectNotationListener listener)
        JavaScriptObjectNotationError error
        error:SetLineNumber(start:startLine)
        error:SetColumnNumber(start:startColumn)
        error:SetIndex(start:startIndex)
        error:SetErrorMessage(message)
        listener:VisitError(error)
    e

Parameters

VisitFalse(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)

This method is called by the JavaScriptObjectNotationParser to visit a text object.

Example Code

use Libraries.Data.Formats.JavaScriptObjectNotationListener
    use Libraries.Data.Formats.JavaScriptObjectNotationTerminal
    use Libraries.Data.Formats.JavaScriptObjectNotationToken
    use Libraries.Data.Formats.JavaScriptObjectNotationLexer

    private action ParseValue
        JavaScriptObjectNotationListener listener
        JavaScriptObjectNotationLexer lexer
        JavaScriptObjectNotationToken token = lexer:GetToken(1)
        JavaScriptObjectNotationTerminal terminal
        terminal:SetToken(lexer:GetToken(currentToken))
        if token:tokenID = lexer:FALSE
            listener:VisitFalse(terminal)
        end
    e

Parameters

VisitInteger(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)

This method is called by the JavaScriptObjectNotationParser to visit a text object.

Example Code

use Libraries.Data.Formats.JavaScriptObjectNotationListener
    use Libraries.Data.Formats.JavaScriptObjectNotationTerminal
    use Libraries.Data.Formats.JavaScriptObjectNotationToken
    use Libraries.Data.Formats.JavaScriptObjectNotationLexer

    private action ParseValue
        JavaScriptObjectNotationListener listener
        JavaScriptObjectNotationLexer lexer
        JavaScriptObjectNotationToken token = lexer:GetToken(1)
        JavaScriptObjectNotationTerminal terminal
        terminal:SetToken(lexer:GetToken(currentToken))
        if token:tokenID = lexer:INTEGER
            listener:VisitInteger(terminal)
        end
    e

Parameters

VisitNumber(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)

This method is called by the JavaScriptObjectNotationParser to visit a text object.

Example Code

use Libraries.Data.Formats.JavaScriptObjectNotationListener
    use Libraries.Data.Formats.JavaScriptObjectNotationTerminal
    use Libraries.Data.Formats.JavaScriptObjectNotationToken
    use Libraries.Data.Formats.JavaScriptObjectNotationLexer

    private action ParseValue
        JavaScriptObjectNotationListener listener
        JavaScriptObjectNotationLexer lexer
        JavaScriptObjectNotationToken token = lexer:GetToken(1)
        JavaScriptObjectNotationTerminal terminal
        terminal:SetToken(lexer:GetToken(currentToken))
        if token:tokenID = lexer:NUMBER
            listener:VisitNumber(terminal)
        end
    e

Parameters

VisitText(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)

This method is called by the JavaScriptObjectNotationParser to visit a text object.

Example Code

use Libraries.Data.Formats.JavaScriptObjectNotationListener
    use Libraries.Data.Formats.JavaScriptObjectNotationTerminal
    use Libraries.Data.Formats.JavaScriptObjectNotationToken
    use Libraries.Data.Formats.JavaScriptObjectNotationLexer

    private action ParseValue
        JavaScriptObjectNotationListener listener
        JavaScriptObjectNotationLexer lexer
        JavaScriptObjectNotationToken token = lexer:GetToken(1)
        JavaScriptObjectNotationTerminal terminal
        terminal:SetToken(lexer:GetToken(currentToken))
        if token:tokenID = lexer:TEXT
            listener:VisitText(terminal)
        end
    e

Parameters

VisitTrue(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)

This method is called by the JavaScriptObjectNotationParser to visit a text object.

Example Code

use Libraries.Data.Formats.JavaScriptObjectNotationListener
    use Libraries.Data.Formats.JavaScriptObjectNotationTerminal
    use Libraries.Data.Formats.JavaScriptObjectNotationToken
    use Libraries.Data.Formats.JavaScriptObjectNotationLexer

    private action ParseValue
        JavaScriptObjectNotationListener listener
        JavaScriptObjectNotationLexer lexer
        JavaScriptObjectNotationToken token = lexer:GetToken(1)
        JavaScriptObjectNotationTerminal terminal
        terminal:SetToken(lexer:GetToken(currentToken))
        if token:tokenID = lexer:TRUE
            listener:VisitTrue(terminal)
        end
    e

Parameters

VisitUndefined(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)

This method is called by the JavaScriptObjectNotationParser to visit a text object.

Example Code

use Libraries.Data.Formats.JavaScriptObjectNotationListener
    use Libraries.Data.Formats.JavaScriptObjectNotationTerminal
    use Libraries.Data.Formats.JavaScriptObjectNotationToken
    use Libraries.Data.Formats.JavaScriptObjectNotationLexer

    private action ParseValue
        JavaScriptObjectNotationListener listener
        JavaScriptObjectNotationLexer lexer
        JavaScriptObjectNotationToken token = lexer:GetToken(1)
        JavaScriptObjectNotationTerminal terminal
        terminal:SetToken(lexer:GetToken(currentToken))
        if token:tokenID = lexer:NULL
            listener:VisitUndefined(terminal)
        end
    e

Parameters