Translators: Language Dictionary - UA-ScriptEase/scriptease GitHub Wiki
JULES: What country are you from?
BRETT: What? What? Wh - ?
JULES: "What" ain't no country I've ever heard of. They speak English in What?
-- Pulp Fiction
#Overview The Language Dictionary contains a description of the language's syntax in an XML format. Where the API dictionary is a description of what you can say, this is a description of how to say it. These are almost invariably much, much shorter than the API dictionary. It includes the following elements, each of which is described in detail further down.
- A
name
attribute - A list of reserved words to never be used as a name for anything ever.
- The indenting string.
- A list of formats, where each format specifies an ordered list of pieces, some of which could be other formats. This is similar in concept to grammar formalisms like Backus-Naur Form. Languages dictionaries are required to contain a
format
with an id of "file" and at least one of "singleComment" or "blockComment"
#Reserved Words List
The ReservedWords
list contains a series of Words that contain text. Those words will never be used in code generation as a name. Words are case sensitive by default but can become insensitive by setting the attribute caseSensitive="false"
.
#Indenting String
IndentString
contains the character(s) to be using for indenting code. Usually this is filled with some number of spaces or a tab character. Leave empty to disable indenting. Be careful to not include extra whitespace characters here (like new lines) or else you'll wind up with oddly formatted code.
#Format List This is a collection of grammatical descriptions (formats) of the output language. There are an arbitrary number of formats, but there are some that are required by ScriptEase.
Each Format
in the Format
s list is a composition of line
s, indent
s, format series
, fragment
s, scope
changes, and/or other formats. The contents of a line
have a newline character appended to the end, while each line inside of an indent
is indented by the indenting string.
Lines must contain either format
s, fragment
s, or literal
s.
Format
s can be referenced with FormatRef
to share definitions.
Series
apply the format they contain over the contents of a data list with the given separator.
#Fragments
Fragment
s are code generator directives - terminal nodes in the code generation tree. The code generator will replace them with the required information in a code-safe way. In other words, use these to tell the code generator to look up some data from the story model. Not all data are accessible in all contexts. To change context, use a scope directive.
Fragments must have a directive to use while generating code. They can also optionally include a regular expression to restrict the possible names that can be generated.
<!ATTLIST fragment
data (type|name|parameters|value|formattedValue|condition|startItCondition|comment|code|slot|codeSymbol)#REQUIRED
default CDATA #IMPLIED
legalFormat CDATA #IMPLIED
>