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

end

Inherits from: Libraries.Language.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.

Parameters

Return

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

Example

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

EnterArray()

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

Example

use Libraries.Data.Formats.JavaScriptObjectNotationListener

private action EnterArray
    JavaScriptObjectNotationListener listener
    listener:EnterArray()
end

EnterObject()

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

Example

use Libraries.Data.Formats.JavaScriptObjectNotationListener

private action EnterObject
    JavaScriptObjectNotationListener listener
    listener:EnterObject()
end

EnterPair()

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

Example

use Libraries.Data.Formats.JavaScriptObjectNotationListener

private action EnterPair
    JavaScriptObjectNotationListener listener
    listener:EnterPair()
end

EnterStart()

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

Example

use Libraries.Data.Formats.JavaScriptObjectNotationListener

private action EnterStart
    JavaScriptObjectNotationListener listener
    listener:EnterStart()
end

EnterValue()

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

Example

use Libraries.Data.Formats.JavaScriptObjectNotationListener

private action EnterStart
    JavaScriptObjectNotationListener listener
    listener:ExitStart()
end

Equals(Libraries.Language.Object object)

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

Parameters

Return

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

Example

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

ExitArray()

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

Example

use Libraries.Data.Formats.JavaScriptObjectNotationListener

private action ExitArray
    JavaScriptObjectNotationListener listener
    listener:ExitArray()
end

ExitObject()

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

Example

use Libraries.Data.Formats.JavaScriptObjectNotationListener

private action ExitObject
    JavaScriptObjectNotationListener listener
    listener:ExitObject()
end

ExitPair()

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

Example

use Libraries.Data.Formats.JavaScriptObjectNotationListener

private action ExitPair
    JavaScriptObjectNotationListener listener
    listener:ExitPair()
end

ExitStart()

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

Example

use Libraries.Data.Formats.JavaScriptObjectNotationListener

private action EnterStart
    JavaScriptObjectNotationListener listener
    listener:ExitStart()
end

ExitValue()

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

Example

use Libraries.Data.Formats.JavaScriptObjectNotationListener

private action EnterStart
    JavaScriptObjectNotationListener listener
    listener:ExitStart()
end

GetHashCode()

This action gets the hash code for an object.

Return

integer: The integer hash code of the object.

Example

Object o
integer hash = o:GetHashCode()

VisitError(Libraries.Data.Formats.JavaScriptObjectNotationError error)

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

Parameters

Example

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)
end

VisitFalse(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)

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

Parameters

Example

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
end

VisitInteger(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)

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

Parameters

Example

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
end

VisitNumber(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)

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

Parameters

Example

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
end

VisitText(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)

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

Parameters

Example

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
end

VisitTrue(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)

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

Parameters

Example

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
end

VisitUndefined(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)

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

Parameters

Example

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
end