Libraries.Data.Formats.JavaScriptObjectNotationDefaultListener 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.JavaScriptObjectNotation
use Libraries.Data.Formats.JavaScriptObjectNotationDefaultListener
use Libraries.Data.Formats.JavaScriptObjectNotationLexer
use Libraries.Data.Formats.JavaScriptObjectNotationParser
class Main
action Main()
Parse("")
end
action Parse(text value) returns JavaScriptObjectNotation
JavaScriptObjectNotationDefaultListener listen
JavaScriptObjectNotationLexer lex
JavaScriptObjectNotationParser parse
lex:SetListener(listen)
parse:SetListener(listen)
lex:Read(value)
parse:Parse(lex)
return listen:GetObject()
end
end
Inherits from: Libraries.Data.Formats.JavaScriptObjectNotationListener, 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
- Libraries.Language.Object: The object to compare to.
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 Object
JavaScriptObjectNotationListener listener
listener:ExitArray()
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 EnterValue event.
Example
use Libraries.Data.Formats.JavaScriptObjectNotationListener
private action EnterValue
JavaScriptObjectNotationListener listener
listener:EnterValue()
end
Equals(Libraries.Language.Object object)
This action determines if two objects are equal based on their hash code values.
Parameters
- Libraries.Language.Object: The to be compared.
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 ExitStart
JavaScriptObjectNotationListener listener
listener:ExitStart()
end
ExitValue()
This method is called by the JavaScriptObjectNotationParser on an ExitValue event.
Example
use Libraries.Data.Formats.JavaScriptObjectNotationListener
private action ExitValue
JavaScriptObjectNotationListener listener
listener:ExitValue()
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()
GetObject()
This method returns the JavaScriptObjectNotation object created from the parse string.
Return
Libraries.Data.Formats.JavaScriptObjectNotation: the JavaScriptObjectNotation object.
Example
use Libraries.Data.Formats.JavaScriptObjectNotation
use Libraries.Data.Formats.JavaScriptObjectNotationDefaultListener
use Libraries.Data.Formats.JavaScriptObjectNotationLexer
use Libraries.Data.Formats.JavaScriptObjectNotationParser
class Main
action Main()
Parse("")
end
action Parse(text value) returns JavaScriptObjectNotation
JavaScriptObjectNotationDefaultListener listen
JavaScriptObjectNotationLexer lex
JavaScriptObjectNotationParser parse
lex:SetListener(listen)
parse:SetListener(listen)
lex:Read(value)
parse:Parse(lex)
return listen:GetObject()
end
end
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
On this page
Variables TableAction Documentation- Compare(Libraries.Language.Object object)
- EnterArray()
- EnterObject()
- EnterPair()
- EnterStart()
- EnterValue()
- Equals(Libraries.Language.Object object)
- ExitArray()
- ExitObject()
- ExitPair()
- ExitStart()
- ExitValue()
- GetHashCode()
- GetObject()
- VisitError(Libraries.Data.Formats.JavaScriptObjectNotationError error)
- VisitFalse(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)
- VisitInteger(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)
- VisitNumber(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)
- VisitText(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)
- VisitTrue(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)
- VisitUndefined(Libraries.Data.Formats.JavaScriptObjectNotationTerminal terminal)