SceneLang interpreter API
Documentation of SceneLang interpreter.
Contents
Public API
Raytracer.Interpreter — ModuleRaytracer.InterpreterSceneLang interpreter module.
Raytracer.Interpreter.TokenValue — TypeTokenValueUnion of all types that can be used as token values while interpreting a SceneLang script.
Types
Raytracer.Interpreter.Identifier — TypeIdentifierType wrapping a Symbol representing an identifier in a SceneLang script.
Fields
value::Symbol: the value of the token
Raytracer.Interpreter.InputStream — TypeInputStreamType wrapping the IO from the source code of a SceneLang script.
Fields
stream::IO: IO stream from the source codelocation::SourceLocation: aSourceLocationthat keeps track of the reading position in the source filesaved_char::Union{Char, Nothing}: stores a character fromunread_char!or nothingsaved_location::SourceLocation: aSourceLocationstoring the previous reading positionsaved_token::Union{Token, Nothing}: stores an unreadedTokentabulations::Int: how many columns a<tab>character is worth
Raytracer.Interpreter.InterpreterException — TypeInterpreterException <: ExceptionAbstract type for all SceneLang interpreter errors.
See also: BadCharacter, UnfinishedExpression, UndefinedIdentifier, WrongTokenType, WrongValueType, InvalidKeyword, InvalidType, InvalidCommand, InvalidExpression, InvalidSymbol, InvalidNumber, InvalidSize, InvalidFilePath, IdentifierRedefinition SettingRedefinition UndefinedSetting
Raytracer.Interpreter.Keyword — TypeKeywordType wrapping a Symbol representing a command or type in a SceneLang script.
Fields
value::Symbol: the value of the token
Raytracer.Interpreter.LiteralNumber — TypeLiteralNumberType wrapping a Float32 representing a floating-point number in a SceneLang script.
Fields
value::Float32: the value of the token
Raytracer.Interpreter.LiteralString — TypeLiteralStringType wrapping a String representing a literal string in a SceneLang script.
Fields
value::String: the value of the token
Raytracer.Interpreter.LiteralSymbol — TypeLiteralSymbolType wrapping a Symbol representing a symbol in a SceneLang script.
Fields
value::Symbol: the value of the token
Raytracer.Interpreter.MathExpression — TypeMathExpressionType wrapping a Expr representing a mathematical expression in a SceneLang script.
Fields
value::Expr: the value of the token
Raytracer.Interpreter.Scene — TypeSceneA mutable struct containing all the significant elements of a renderable scene and all the declared variables of the SceneLang script.
Fields
variables::IdTable: stores all the variables declared in the scriptworld::World: stores all the spawnedShapeslights::Lights: stores all the spawnedPointLightsimage::ImageOrNot: stores either theHdrImageto impress ornothingcamera::CameraOrNot: stores either theCameraornothingrenderer::RendererOrNot: stores either theRendererSettingsfor theRendererornothingtracer::TracerOrNot: strores either theTracerSettingsfor theImageTracerornothingtime::Float32: stores the animation time
Raytracer.Interpreter.Scene — MethodScene(variables::Vector{Pair{Type{<:TokenValue}, Vector{Pair{Symbol, Token}}}};
      world::World = World(),
      lights::Lights = Lights(),
      image::ImageOrNot = nothing,
      camera::CameraOrNot = nothing,
      renderer::RendererOrNot = nothing,
      tracer::TracerOrNot = nothing,
      time = 0f0)Constructor for a Scene instance.
Slightly more convenient than the default constructor to manually construct in a Julia code.
Raytracer.Interpreter.Scene — MethodScene(; variables::IdTable = IdTable(),
        world::World = World(),
        lights::Lights = Lights(),
        image::ImageOrNot = nothing,
        camera::CameraOrNot = nothing,
        renderer::RendererOrNot = nothing,
        tracer::TracerOrNot = nothing,
        time::Float32 = 0f0)Constructor for a Scene instance.
Raytracer.Interpreter.SourceLocation — TypeSourceLocationRepresents a position in a file at a certain line and column.
Fields
file_name::String: the input file nameline_num::Int: line positioncol_num::Int: column position
Raytracer.Interpreter.SourceLocation — MethodSourceLocation(file_name::String, line_num::Int, col_num::Int)Constructor for a SourceLocation instance.
Raytracer.Interpreter.SourceLocation — MethodSourceLocation(; file_name::String = "", line_num::Int = 1, col_num::Int = 0)Constructor for a SourceLocation instance.
Raytracer.Interpreter.StopToken — TypeStopTokenConvenience empty type to help identify the end of a SceneLang script.
Fields
value::Nothing: the value of the token
Raytracer.Interpreter.Token — TypeToken{T <: TokenValue}Type representing a language token of a SceneLang script.
Fields
loc::SourceLocation: aSourceLocationrepresenting the position in the script at which the token starts,value::T: aTokenValuerepresenting the value of the token (seeTokenValue)length::Int: length of the input token.
Raytracer.Interpreter.open_stream — Methodopen_stream(f::Function, file_name::String; tabulations::Int = 8)Open read-only a file named file_name as an InputStream and apply f to it.
Raytracer.Interpreter.parse_scene — Functionparse_scene(stream::InputStream, scene::Scene = Scene())Return the Scene instance resulting parsing the SceneLang script associated with the given InputStream.
Raytracer.Interpreter.parse_variables_from_string — Methodparse_variables_from_string(str::AbstractString; table::IdTable = IdTable()) -> IdTableParse a string containing comma separated identifier-constructor pairs and return the resulting IdTable.
Private API
Raytracer.Interpreter.CameraOrNot — TypeRaytracer.Interpreter.IdTableKey — TypeIdTableKeyAlias for Union{Type{<:TokenValue}, LiteralType}. Used as the key type for IdTable.
Raytracer.Interpreter.ImageOrNot — TypeRaytracer.Interpreter.RendererOrNot — TypeRaytracer.Interpreter.TracerOrNot — TypeRaytracer.Interpreter.valid_operations — Constantvalid_operationsA dictionary storing the operation Symbol and a function ::Int -> ::Bool that return true when the number of arguments is under a threshold.
For example the pair :+ => ( ::Int) -> true indicates that the operation + is valid with any number of arguments, while the pair :floor => (n::Int) -> n == 1 indicates that the operation floor is valid only if it has one argument.
See also: Raytracer.isvalid
Raytracer.Interpreter.BadCharacter — TypeBadCharacter <: InterpreterExceptionThere is an invalid character in the SceneLang script.
See also: InterpreterException
Fields
location::SourceLocation: location of the errormsg::AbstractString: descriptive error messagelen::Int: how many characters are involved in the error
Raytracer.Interpreter.BadCharacter — MethodBadCharacter(location::SourceLocation, msg::AbstractString)Construct an instance of BadCharacter with len = 1.
Raytracer.Interpreter.Command — TypeCommandEnum type listing all commands of SceneLang.
Instances
Raytracer.Interpreter.USINGRaytracer.Interpreter.SETRaytracer.Interpreter.UNSETRaytracer.Interpreter.SPAWNRaytracer.Interpreter.DUMPRaytracer.Interpreter.LOADRaytracer.Interpreter.ROTATERaytracer.Interpreter.TRANSLATERaytracer.Interpreter.SCALERaytracer.Interpreter.UNITERaytracer.Interpreter.INTERSECTRaytracer.Interpreter.DIFFRaytracer.Interpreter.FUSERaytracer.Interpreter.TIME
Raytracer.Interpreter.IdTable — TypeIdTableAlias to Dict{IdTableKey, Dict{Symbol, ValueLoc}}.
Dictionary with all the variables set in a SceneLang script. Keys represent the equivalent TokenValue or LiteralType type to the Julia type stored in ValueLoc.
Raytracer.Interpreter.IdentifierRedefinition — TypeIdentifierRedefinition <: InterpreterExceptionAn identifier is being redefined without being unset first.
See also: InterpreterException
Fields
location::SourceLocation: location of the errormsg::AbstractString: descriptive error messagelen::Int: how many characters are involved in the error
Raytracer.Interpreter.IdentifierRedefinition — MethodIdentifierRedefinition(location::SourceLocation, msg::AbstractString)Construct an instance of IdentifierRedefinition with len = 1.
Raytracer.Interpreter.InvalidCommand — TypeInvalidCommand <: InterpreterExceptionThe given command does not exist.
See also: InterpreterException
Fields
location::SourceLocation: location of the errormsg::AbstractString: descriptive error messagelen::Int: how many characters are involved in the error
Raytracer.Interpreter.InvalidCommand — MethodInvalidCommand(location::SourceLocation, msg::AbstractString)Construct an instance of InvalidCommand with len = 1.
Raytracer.Interpreter.InvalidExpression — TypeInvalidExpression <: InterpreterExceptionThe given expression contains invalid elements. Capabilities are restrained to contain malicious code injection.
See also: InterpreterException
Fields
location::SourceLocation: location of the errormsg::AbstractString: descriptive error messagelen::Int: how many characters are involved in the error
Raytracer.Interpreter.InvalidExpression — MethodInvalidExpression(location::SourceLocation, msg::AbstractString)Construct an instance of InvalidExpression with len = 1.
Raytracer.Interpreter.InvalidFilePath — TypeInvalidFilePath <: InterpreterExceptionThe given file path is invalid.
See also: InterpreterException
Fields
location::SourceLocation: location of the errormsg::AbstractString: descriptive error messagelen::Int: how many characters are involved in the error
Raytracer.Interpreter.InvalidFilePath — MethodInvalidFilePath(location::SourceLocation, msg::AbstractString)Construct an instance of InvalidFilePath with len = 1.
Raytracer.Interpreter.InvalidKeyword — TypeInvalidKeyword <: InterpreterExceptionThe given keyword is not valid in the given context.
See also: InterpreterException
Fields
location::SourceLocation: location of the errormsg::AbstractString: descriptive error messagelen::Int: how many characters are involved in the error
Raytracer.Interpreter.InvalidKeyword — MethodInvalidKeyword(location::SourceLocation, msg::AbstractString)Construct an instance of InvalidKeyword with len = 1.
Raytracer.Interpreter.InvalidNumber — TypeInvalidNumber <: InterpreterExceptionThe token has an invalid numerical format.
See also: InterpreterException
Fields
location::SourceLocation: location of the errormsg::AbstractString: descriptive error messagelen::Int: how many characters are involved in the error
Raytracer.Interpreter.InvalidNumber — MethodInvalidNumber(location::SourceLocation, msg::AbstractString)Construct an instance of InvalidNumber with len = 1.
Raytracer.Interpreter.InvalidSize — TypeInvalidSize <: InterpreterExceptionThe given collection has an invalid size in the given context.
See also: InterpreterException
Fields
location::SourceLocation: location of the errormsg::AbstractString: descriptive error messagelen::Int: how many characters are involved in the error
Raytracer.Interpreter.InvalidSize — MethodInvalidSize(location::SourceLocation, msg::AbstractString)Construct an instance of InvalidSize with len = 1.
Raytracer.Interpreter.InvalidSymbol — TypeInvalidSymbol <: InterpreterExceptionThe given symbol is not valid in the given context.
See also: InterpreterException
Fields
location::SourceLocation: location of the errormsg::AbstractString: descriptive error messagelen::Int: how many characters are involved in the error
Raytracer.Interpreter.InvalidSymbol — MethodInvalidSymbol(location::SourceLocation, msg::AbstractString)Construct an instance of InvalidSymbol with len = 1.
Raytracer.Interpreter.InvalidType — TypeInvalidType <: InterpreterExceptionThe given type does not exist.
See also: InterpreterException
Fields
location::SourceLocation: location of the errormsg::AbstractString: descriptive error messagelen::Int: how many characters are involved in the error
Raytracer.Interpreter.InvalidType — MethodInvalidType(location::SourceLocation, msg::AbstractString)Construct an instance of InvalidType with len = 1.
Raytracer.Interpreter.LiteralType — TypeLiteralTypeEnum type listing all main types of SceneLang.
Instances
Raytracer.Interpreter.ColorTypeRaytracer.Interpreter.PointTypeRaytracer.Interpreter.ListTypeRaytracer.Interpreter.TransformationTypeRaytracer.Interpreter.MaterialTypeRaytracer.Interpreter.BrdfTypeRaytracer.Interpreter.PigmentTypeRaytracer.Interpreter.ShapeTypeRaytracer.Interpreter.LightTypeRaytracer.Interpreter.ImageTypeRaytracer.Interpreter.RendererTypeRaytracer.Interpreter.CameraTypeRaytracer.Interpreter.PcgTypeRaytracer.Interpreter.TracerType
Raytracer.Interpreter.RendererSettings — TypeRendererSettingsStruct containing a renderer type and a NamedTuple of the named arguments needed for its construction.
Since a Renderer type cannot be directly stored into a Scene due to it needing at least the World argument, we can use this struct to store everything else, ready to be constructed.
Raytracer.Interpreter.SettingRedefinition — TypeSettingRedefinition <: InterpreterExceptionA rendering setting is being defined multiple times.
See also: InterpreterException
Fields
location::SourceLocation: location of the errormsg::AbstractString: descriptive error messagelen::Int: how many characters are involved in the error
Raytracer.Interpreter.SettingRedefinition — MethodSettingRedefinition(location::SourceLocation, msg::AbstractString)Construct an instance of SettingRedefinition with len = 1.
Raytracer.Interpreter.TracerSettings — TypeTracerSettingsStruct containing a NamedTuple of the named arguments needed to construct an ImageTracer.
Since a ImageTracer type cannot be directly stored into a Scene due to it needing at least the Camera and HdrImage arguments, we can use this struct to store everything else, ready to be constructed.
Raytracer.Interpreter.UndefinedIdentifier — TypeUndefinedIdentifier <: InterpreterExceptionThe given identifier has not been defined in the script.
See also: InterpreterException
Fields
location::SourceLocation: location of the errormsg::AbstractString: descriptive error messagelen::Int: how many characters are involved in the error
Raytracer.Interpreter.UndefinedIdentifier — MethodUndefinedIdentifier(location::SourceLocation, msg::AbstractString)Construct an instance of UndefinedIdentifier with len = 1.
Raytracer.Interpreter.UndefinedSetting — TypeUndefinedSetting <: InterpreterExceptionOne or more necessary rendering settings have not been set up in the SceneLang script.
See also: InterpreterException
Fields
location::SourceLocation: location of the errormsg::AbstractString: descriptive error messagelen::Int: how many characters are involved in the error
Raytracer.Interpreter.UndefinedSetting — MethodUndefinedSetting(location::SourceLocation, msg::AbstractString)Construct an instance of UndefinedSetting with len = 1.
Raytracer.Interpreter.UnfinishedExpression — TypeUnfinishedExpression <: InterpreterExceptionA special environment (e.g. a string, mathematical expression, list...) has been opened and not closed.
See also: InterpreterException
Fields
location::SourceLocation: location of the errormsg::AbstractString: descriptive error messagelen::Int: how many characters are involved in the error
Raytracer.Interpreter.UnfinishedExpression — MethodUnfinishedExpression(location::SourceLocation, msg::AbstractString)Construct an instance of UnfinishedExpression with len = 1.
Raytracer.Interpreter.ValueLoc — TypeValueLocStores a Julia value and the source location of its declaration.
Raytracer.Interpreter.WrongTokenType — TypeWrongTokenType <: InterpreterExceptionThe given value is of a different type than expected by the syntax.
See also: InterpreterException
Fields
location::SourceLocation: location of the errormsg::AbstractString: descriptive error messagelen::Int: how many characters are involved in the error
Raytracer.Interpreter.WrongTokenType — MethodWrongTokenType(location::SourceLocation, msg::AbstractString)Construct an instance of WrongTokenType with len = 1.
Raytracer.Interpreter.WrongValueType — TypeWrongValueType <: InterpreterExceptionThe given value has a different type than expected by the syntax.
See also: InterpreterException
Fields
location::SourceLocation: location of the errormsg::AbstractString: descriptive error messagelen::Int: how many characters are involved in the error
Raytracer.Interpreter.WrongValueType — MethodWrongValueType(location::SourceLocation, msg::AbstractString)Construct an instance of WrongValueType with len = 1.
Base.eof — Methodeof(stream::InputStream)Check if the stream has reached the end-of-file.
Base.isvalid — MethodRaytracer.isvalid(expr::Expr, str_len::Int, token_location::SourceLocation)Return true if the given expression is valid in a SceneLang script, else throw an appropriate exception using str_len and token_location.
See also: valid_operations
Raytracer.Interpreter._parse_command_or_type_token — Method_parse_command_or_type_token(stream::InputStream, first_char::Char, token_location::SourceLocation)Parse the stream into a Token with Command or LiteralType value.
Raytracer.Interpreter._parse_identifier_token — Method_parse_identifier_token(stream::InputStream, first_char::Char, token_location::SourceLocation)Parse the stream into a Token with Identifier value.
Raytracer.Interpreter._parse_keyword_token — Method_parse_keyword_token(stream::InputStream, first_char::Char, token_location::SourceLocation)Raytracer.Interpreter._parse_math_expression_token — Method_parse_math_expression_token(stream::InputStream, token_location::SourceLocation)Parse the stream into a Token with MathExpression value.
Raytracer.Interpreter._parse_number_token — Method_parse_number_token(stream::InputStream, first_char::Char, token_location::SourceLocation)Parse the stream into a Token with LiteralNumber value.
Raytracer.Interpreter._parse_string_token — Method_parse_string_token(stream::InputStream, token_location::SourceLocation)Parse the stream into a Token with LiteralString value.
Raytracer.Interpreter._update_pos! — Method_update_pos!(stream::InputStream, ch::Union{Char, Nothing})Update stream.location after having read ch from the stream.
Raytracer.Interpreter.evaluate_math_expression — Methodevaluate_math_expression(token::Token{MathExpression}, scene::Scene)Replace all identifiers in the mathematical expression stored in the MathExpression token and then evaluate it.
Raytracer.Interpreter.expect_command — Methodexpect_command(stream::InputStream, command::Command)Read a token from an InputStream and check that it is a given Command.
Raytracer.Interpreter.expect_command — Methodexpect_command(stream::InputStream, commands::Union{NTuple{N, Command} where {N}, AbstractVector{Command}})Read a token from an InputStream and check that it is a Command in the given commands.
Raytracer.Interpreter.expect_command — Methodexpect_command(stream::InputStream)Read a token from an InputStream and check that it is a Command.
Raytracer.Interpreter.expect_identifier — Methodexpect_identifier(stream::InputStream)Read a token from an InputStream and check that it is an Identifier.
Raytracer.Interpreter.expect_keyword — Methodexpect_keyword(stream::InputStream, keyword::Symbol)Read a token from an InputStream and check that it is a given Keyword.
Raytracer.Interpreter.expect_keyword — Methodexpect_keyword(stream::InputStream, keywords_list::Union{NTuple{N, Symbol} where {N}, AbstractVector{Symbol}})Read a token from an InputStream and check that it is a Keyword in keywords_list.
Raytracer.Interpreter.expect_number — Methodexpect_number(stream::InputStream, scene::Scene)Read a token from an InputStream and check that it is a LiteralNumber.
Raytracer.Interpreter.expect_string — Methodexpect_string(stream::InputStream)Read a token from an InputStream and check that it is a LiteralString.
Raytracer.Interpreter.expect_symbol — Methodexpect_symbol(stream::InputStream, symbol::LiteralSymbol)Read a token from an InputStream and check that it is the requested LiteralSymbol.
Raytracer.Interpreter.expect_symbol — Methodexpect_symbol(stream::InputStream, symbols::Union{Tuple{N, Symbol} where {N}, AbstractVector{Symbol}})Read a token from an InputStream and check that it is one of the requested LiteralSymbols.
Raytracer.Interpreter.expect_type — Methodexpect_type(stream::InputStream, type::LiteralType)Read a token from an InputStream and check that it is a given LiteralType.
Raytracer.Interpreter.expect_type — Methodexpect_type(stream::InputStream, types::Union{NTuple{N, LiteralType} where {N}, AbstractVector{LiteralType}})Read a token from an InputStream and check that it is a LiteralType in the given types.
Raytracer.Interpreter.expect_type — Methodexpect_type(stream::InputStream)Read a token from an InputStream and check that it is a LiteralType.
Raytracer.Interpreter.generate_kwargs — Methodfunction generate_kwargs(stream::InputStream, scene::Scene, kw::NamedTuple)Return a Dict{Symbol, Any} as instructed by the given kw NamedTuple.
The argument kw pairs all the keywords a constructor need with the parsing functions they need. This function parses keywords and/or values until it reaches the end of the constructor. The arguments may also be positional, but positional arguments must not follow keyword arguments. If a keyword is used more than once an exception is thrown.
Raytracer.Interpreter.isnewline — Methodisnewline(c::Char)Check if c is a newline character.
Raytracer.Interpreter.issymbol — Methodissymbol(c::Char)Check if c is in a partucular set of characters used in a SceneLang script.
Raytracer.Interpreter.parse_brdf — Methodparse_brdf(stream::InputStream, scene::Scene)Return a BRDF value from either a named constructor or an appropriate Identifier.
The concrete type is determined by the first keyword after the BrdfType token, which also determines the keyword arguments to be read by generate_kwargs.
Raytracer.Interpreter.parse_by_identifier — Methodparse_by_identifier(expected_type::IdTableKey, stream::InputStream, table::IdTable)If the next token is an Identifier, check that its type is coherent with expected_type and return its value.
Raytracer.Interpreter.parse_camera — Methodparse_camera(stream::InputStream, scene::Scene)Return a Camera value from either a named constructor or an appropriate Identifier.
The concrete type is determined by the first keyword after the CameraType token, which also determines the keyword arguments to be read by generate_kwargs.
Raytracer.Interpreter.parse_color — Methodparse_color(stream::InputStream, scene::Scene)Return a RGB{Float32} value from either a named constructor, a symbolic constructor, an appropriate MathExpression, or an appropriate Identifier.
If the constructor has not exactly three arguments an exception will be thrown.
Raytracer.Interpreter.parse_constructor — Methodparse_constructor(stream::InputStream, scene::Scene)Return a Tuple{Any, IdTableKey} containing the result of the construction and its type.
If the expression from the stream is not a valid constructor an exception is thrown.
Raytracer.Interpreter.parse_dump_command — Methodparse_dump_command(stream::InputStream, scene::Scene)Show the contents of the Scene. What is shown depends on the Keyword following the DUMP Command.
The valid Keywords are .ALL for showing the whole Scene, or the name of one of its fields (in lowercase letters) to show that specific field.
Raytracer.Interpreter.parse_explicit_image — Methodparse_explicit_image(stream::InputStream, scene::Scene)Return an HdrImage value from a named constructor.
There are two versions of the constructor:
- one taking a valid file path 
LiteralStringas the only argument and loading the image stored in that file - the other taking two integer 
LiteralNumbers as width and height and constructing an empty image. 
See also: parse_image
Raytracer.Interpreter.parse_explicit_shape — Methodparse_explicit_shape(stream::InputStream, scene::Scene)Return a Shape value from either a named constructor or an appropriate Identifier.
The concrete type is determined by the first keyword after the ShapeType token, which also determines the keyword arguments to be read by generate_kwargs.
Raytracer.Interpreter.parse_explicit_transformation — Methodparse_explicit_transformation(stream::InputStream, scene::Scene)Return a Transformation value from a named constructor taking a 16-long list as the only argument.
There is no way to set the inverse matrix, so it will be calculated by the inv algorithm upon construction.
See also: parse_transformation
Raytracer.Interpreter.parse_float — Methodparse_float(stream::InputStream, scene::Scene)Return a Float32 value from either a LiteralNumber constructor, the TIME command, an appropriate MathExpression, or an appropriate Identifier.
Raytracer.Interpreter.parse_fusion — Methodparse_fusion(stream::InputStream, scene::Scene)Return a FusionCSG value from the FUSE Command.
See also: parse_shape_from_command
Raytracer.Interpreter.parse_image — Methodparse_image(stream::InputStream, scene::Scene)Return an HdrImage value from either a named constructor, a construction command, or an appropriate Identifier.
See also: parse_explicit_image, parse_image_from_command
Raytracer.Interpreter.parse_image_from_command — Methodparse_image_from_command(stream::InputStream, scene::Scene)Return an HdrImage value from the LOAD Command.
The LOAD Command takes only one LiteralString representing a valid file path to an image file as an argument.
See also: parse_image
Raytracer.Interpreter.parse_int — Methodparse_int(stream::InputStream, scene::Scene)Return a Int value from either a LiteralNumber constructor, the TIME command, an appropriate MathExpression, or an appropriate Identifier.
If the Float32 number is not exactly representing an integer number an exception is thrown.
Raytracer.Interpreter.parse_intersection — Methodparse_intersection(stream::InputStream, scene::Scene)Return a IntersectionCSG value from the INTERSECT Command.
See also: parse_shape_from_command
Raytracer.Interpreter.parse_light — Methodparse_light(stream::InputStream, scene::Scene)Return a PointLight value from either a named constructor or an appropriate Identifier.
Raytracer.Interpreter.parse_list — Methodparse_list(stream::InputStream, scene::Scene, list_length::Int)Return a SVector{list_length, Float32} value from either a named constructor, a symbolic constructor or an appropriate Identifier.
If the list is not exactly list_length long an exception will be thrown.
Raytracer.Interpreter.parse_list — Methodparse_list(stream::InputStream, scene::Scene)Return a Vector{Float32} value from either a named constructor, a symbolic constructor or an appropriate Identifier.
Raytracer.Interpreter.parse_material — Methodparse_material(stream::InputStream, scene::Scene)Return a Material value from either a named constructor or an appropriate Identifier.
The concrete type is determined by the first keyword after the MaterialType token, which also determines the keyword arguments to be read by generate_kwargs.
Raytracer.Interpreter.parse_pcg — Methodparse_pcg(stream::InputStream, scene::Scene)Return a PCG value from either a named constructor or an appropriate Identifier.
Raytracer.Interpreter.parse_pigment — Methodparse_pigment(stream::InputStream, scene::Scene)Return a Pigment value from either a named constructor or an appropriate Identifier.
The concrete type is determined by the first keyword after the PigmentType token, which also determines the keyword arguments to be read by generate_kwargs.
Raytracer.Interpreter.parse_point — Methodparse_point(stream::InputStream, scene::Scene)Return a Point value from either a named constructor, a symbolic constructor, an appropriate MathExpression, or an appropriate Identifier.
If the constructor has not exactly three arguments an exception will be thrown.
Raytracer.Interpreter.parse_renderer_settings — Methodparse_renderer_settings(stream::InputStream, scene::Scene)Return a RendererSettings value from either a named constructor or an appropriate Identifier.
The renderer type is determined by the first keyword after the RendererType token, which also determines the keyword arguments to be read by generate_kwargs and stored in the kwargs field of the result.
Raytracer.Interpreter.parse_rotation — Methodparse_rotation(stream::InputStream, scene::Scene)Return a Transformation value from the ROTATE Command.
The argument of this command is a sequence of keyword arguments, with keywords representing the three axes of rotation .X, .Y, and .Z, followed by a number representing the rotation angle in degrees. Each of these keyword arguments are separated by a * operator which behaves as a concatenation of rotation following the usual rules of matrix multiplication (i.e. the rightmost rotation will be the first to be applied)
See also: parse_transformation_from_command
Raytracer.Interpreter.parse_scaling — Methodparse_scaling(stream::InputStream, scene::Scene)Return a Transformation value from the SCALE Command.
The arguments of this command are a sequence of keyword arguments, with keywords representing the three axes of scaling .X, .Y, and .Z, followed by a number representing the scaling factor. Each of these keyword arguments are separated by a ,. The order of these arguments is indifferent since, in our euclidean space, scalings are commutative transformations.
An alternate form of this command sees only one numeric argument, without parenthesis, and indicates uniform scaling in all directions.
See also: parse_transformation_from_command
Raytracer.Interpreter.parse_set_command — Methodparse_set_command(stream::InputStream, scene::Scene)Push to the 'scene.variables' IdTable a constructed value and its identifier variable.
Raytracer.Interpreter.parse_setdiff — Methodparse_setdiff(stream::InputStream, scene::Scene)Return a DiffCSG value from the DIFF Command.
See also: parse_shape_from_command
Raytracer.Interpreter.parse_shape — Methodparse_shape(stream::InputStream, scene::Scene)Return a Shape value from either a named constructor, a construction command, or an appropriate Identifier.
See also: parse_explicit_shape, parse_shape_from_command
Raytracer.Interpreter.parse_shape_from_command — Methodparse_shape_from_command(stream::InputStream, scene::Scene)Return a Shape value from the UNITE, INTERSECT, DIFF, and FUSE Commands.
See also: parse_shape, parse_union, parse_intersection, parse_setdiff, parse_fusion
Raytracer.Interpreter.parse_spawn_command — Methodparse_spawn_command(stream::InputStream, scene::Scene)Push the given ShapeType or LightType to the scene.world World or scene.lights Lights respectively.
See also: Scene
Raytracer.Interpreter.parse_string — Methodparse_string(stream::InputStream, scene::Scene)Return a String value from either a LiteralString constructor or an appropriate Identifier.
Raytracer.Interpreter.parse_tracer_settings — Methodparse_tracer_settings(stream::InputStream, scene::Scene)Return a TracerSettings value from either a named constructor or an appropriate Identifier.
Raytracer.Interpreter.parse_transformation — Methodparse_transformation(stream::InputStream, scene::Scene)Return a Transformation value from either a named constructor, a construction command, or an appropriate Identifier.
If the constructor/command/identifier is followed by an * operator the transformations will be concatenated following the usual matrix multiplication rules (i.e. the rightmost transformation will be applied first).
See also: parse_explicit_transformation, parse_transformation_from_command
Raytracer.Interpreter.parse_transformation_from_command — Methodparse_transformation_from_command(stream::InputStream, scene::Scene)Return a Transformation value from the ROTATE, TRANSLATE, and SCALE Commands.
See also: parse_transformation, parse_rotation, parse_translation, parse_scaling
Raytracer.Interpreter.parse_translation — Methodparse_translation(stream::InputStream, scene::Scene)Return a Transformation value from the TRANSLATE Command.
The arguments of this command are a sequence of keyword arguments, with keywords representing the three axes of translation .X, .Y, and .Z, followed by a number representing the displacement. Each of these keyword arguments are separated by a ,. The order of these arguments is indifferent since, in our euclidean space, translations are commutative transformations.
See also: parse_transformation_from_command
Raytracer.Interpreter.parse_union — Methodparse_union(stream::InputStream, scene::Scene)Return a UnionCSG value from the UNITE Command.
See also: parse_shape_from_command
Raytracer.Interpreter.parse_unset_command — Methodparse_unset_command(stream::InputStream, scene::Scene)Pop identifier variable from the scene.variables IdTable.
Raytracer.Interpreter.parse_using_command — Methodparse_using_command(stream::InputStream, scene::Scene)Set the given CameraType, ImageType or RendererType to the scene.camera, scene.image, or scene.renderer respectively.
Can only be used once per type in a SceneLang script.
See also: Scene
Raytracer.Interpreter.read_at_line — Methodread_at_line(io::IO, line_num::Int)Read the line_num-th line of io.
Raytracer.Interpreter.read_at_line — Methodread_at_line(file_name::String, line_num::Int)Read the line_num-th line of a file named file_name.
Raytracer.Interpreter.read_char! — Methodread_char!(stream::InputStream)Read a new character from the stream.
Raytracer.Interpreter.read_token — Methodread_token(stream::InputStream)Read the next token in the stream.
Raytracer.Interpreter.skip_whitespaces_and_comments — Methodskip_whitespaces_and_comments(stream::InputStream)Keep reading characters until a non-whitespace character is found out of a commented line.
Raytracer.Interpreter.unread_char! — Methodunread_char!(stream::InputStream, ch::Union{Char, Nothing})Push a character back to the stream. Accepts a nothing value to deal with eof.
Raytracer.Interpreter.unread_token — Methodunread_token(stream::InputStream, ch::Token)Push a token back to the stream.
Index
Raytracer.Interpreter.valid_operationsRaytracer.Interpreter.BadCharacterRaytracer.Interpreter.BadCharacterRaytracer.Interpreter.CameraOrNotRaytracer.Interpreter.CommandRaytracer.Interpreter.IdTableRaytracer.Interpreter.IdTableKeyRaytracer.Interpreter.IdentifierRaytracer.Interpreter.IdentifierRedefinitionRaytracer.Interpreter.IdentifierRedefinitionRaytracer.Interpreter.ImageOrNotRaytracer.Interpreter.InputStreamRaytracer.Interpreter.InterpreterExceptionRaytracer.Interpreter.InvalidCommandRaytracer.Interpreter.InvalidCommandRaytracer.Interpreter.InvalidExpressionRaytracer.Interpreter.InvalidExpressionRaytracer.Interpreter.InvalidFilePathRaytracer.Interpreter.InvalidFilePathRaytracer.Interpreter.InvalidKeywordRaytracer.Interpreter.InvalidKeywordRaytracer.Interpreter.InvalidNumberRaytracer.Interpreter.InvalidNumberRaytracer.Interpreter.InvalidSizeRaytracer.Interpreter.InvalidSizeRaytracer.Interpreter.InvalidSymbolRaytracer.Interpreter.InvalidSymbolRaytracer.Interpreter.InvalidTypeRaytracer.Interpreter.InvalidTypeRaytracer.Interpreter.KeywordRaytracer.Interpreter.LiteralNumberRaytracer.Interpreter.LiteralStringRaytracer.Interpreter.LiteralSymbolRaytracer.Interpreter.LiteralTypeRaytracer.Interpreter.MathExpressionRaytracer.Interpreter.RendererOrNotRaytracer.Interpreter.RendererSettingsRaytracer.Interpreter.SceneRaytracer.Interpreter.SceneRaytracer.Interpreter.SceneRaytracer.Interpreter.SettingRedefinitionRaytracer.Interpreter.SettingRedefinitionRaytracer.Interpreter.SourceLocationRaytracer.Interpreter.SourceLocationRaytracer.Interpreter.SourceLocationRaytracer.Interpreter.StopTokenRaytracer.Interpreter.TokenRaytracer.Interpreter.TokenValueRaytracer.Interpreter.TracerOrNotRaytracer.Interpreter.TracerSettingsRaytracer.Interpreter.UndefinedIdentifierRaytracer.Interpreter.UndefinedIdentifierRaytracer.Interpreter.UndefinedSettingRaytracer.Interpreter.UndefinedSettingRaytracer.Interpreter.UnfinishedExpressionRaytracer.Interpreter.UnfinishedExpressionRaytracer.Interpreter.ValueLocRaytracer.Interpreter.WrongTokenTypeRaytracer.Interpreter.WrongTokenTypeRaytracer.Interpreter.WrongValueTypeRaytracer.Interpreter.WrongValueTypeRaytracer.Interpreter._parse_command_or_type_tokenRaytracer.Interpreter._parse_identifier_tokenRaytracer.Interpreter._parse_keyword_tokenRaytracer.Interpreter._parse_math_expression_tokenRaytracer.Interpreter._parse_number_tokenRaytracer.Interpreter._parse_string_tokenRaytracer.Interpreter._update_pos!Raytracer.Interpreter.evaluate_math_expressionRaytracer.Interpreter.expect_commandRaytracer.Interpreter.expect_commandRaytracer.Interpreter.expect_commandRaytracer.Interpreter.expect_identifierRaytracer.Interpreter.expect_keywordRaytracer.Interpreter.expect_keywordRaytracer.Interpreter.expect_numberRaytracer.Interpreter.expect_stringRaytracer.Interpreter.expect_symbolRaytracer.Interpreter.expect_symbolRaytracer.Interpreter.expect_typeRaytracer.Interpreter.expect_typeRaytracer.Interpreter.expect_typeRaytracer.Interpreter.generate_kwargsRaytracer.Interpreter.isnewlineRaytracer.Interpreter.issymbolRaytracer.Interpreter.open_streamRaytracer.Interpreter.parse_brdfRaytracer.Interpreter.parse_by_identifierRaytracer.Interpreter.parse_cameraRaytracer.Interpreter.parse_colorRaytracer.Interpreter.parse_constructorRaytracer.Interpreter.parse_dump_commandRaytracer.Interpreter.parse_explicit_imageRaytracer.Interpreter.parse_explicit_shapeRaytracer.Interpreter.parse_explicit_transformationRaytracer.Interpreter.parse_floatRaytracer.Interpreter.parse_fusionRaytracer.Interpreter.parse_imageRaytracer.Interpreter.parse_image_from_commandRaytracer.Interpreter.parse_intRaytracer.Interpreter.parse_intersectionRaytracer.Interpreter.parse_lightRaytracer.Interpreter.parse_listRaytracer.Interpreter.parse_listRaytracer.Interpreter.parse_materialRaytracer.Interpreter.parse_pcgRaytracer.Interpreter.parse_pigmentRaytracer.Interpreter.parse_pointRaytracer.Interpreter.parse_renderer_settingsRaytracer.Interpreter.parse_rotationRaytracer.Interpreter.parse_scalingRaytracer.Interpreter.parse_sceneRaytracer.Interpreter.parse_set_commandRaytracer.Interpreter.parse_setdiffRaytracer.Interpreter.parse_shapeRaytracer.Interpreter.parse_shape_from_commandRaytracer.Interpreter.parse_spawn_commandRaytracer.Interpreter.parse_stringRaytracer.Interpreter.parse_tracer_settingsRaytracer.Interpreter.parse_transformationRaytracer.Interpreter.parse_transformation_from_commandRaytracer.Interpreter.parse_translationRaytracer.Interpreter.parse_unionRaytracer.Interpreter.parse_unset_commandRaytracer.Interpreter.parse_using_commandRaytracer.Interpreter.parse_variables_from_stringRaytracer.Interpreter.read_at_lineRaytracer.Interpreter.read_at_lineRaytracer.Interpreter.read_char!Raytracer.Interpreter.read_tokenRaytracer.Interpreter.skip_whitespaces_and_commentsRaytracer.Interpreter.unread_char!Raytracer.Interpreter.unread_token