Unformatted text preview:

ScriptEdit Language Reference Manual Bhavesh Patira bp2214 columbia edu Bethany M Soule bms2126 columbia edu Deni Pejanovic dp2232 columbia edu Marc Vinyes mv2258 columbia edu March 5 2007 1 Introduction ScriptEdit is a language that allows you to automatically generate text from a limited set of instructions You can write new files with this text or insert it into an existing file The instructions may use the text of the edited file external files or text generated by other standard input output based applications as input ScriptEdit is similar to a macro processor in the sense that replaces text with other text but it can also create new files from one single source The main goal of this language is to allow the user to edit files and the script operations that are needed to create their content all from within one single source file Often editing content text files HTML LATEX XML etc is a process that involves several different steps and programs like separate bash scripts a text editor and other console programs e g using ImageMagick to edit images or using Matlab to create graphs that will be linked ScriptEdit is a way to put all those different process calls together with the content text file 1 2 Overall idea A script edit code is a text file that contains script edit statements interleaved with text from another language We will refer to the latter as string constants a more detailed definition is given later Statements process this text and may output text in the position where they are written 3 Main lexical conventions We have the following kinds of tokens string constants keywords characters that separate the arguments of a keyword identifiers conditions mathematical expressions the declaration operator and the content operator Their definitions are provided throughout this document Whitespace including tabs and newlines are generally relevant everywhere except when indicated otherwise within this manual For example leading and trailing whitespaces are not ignored My String Variable is not equivalent to My String not equivalent to My String Variable 3 1 Variable is String constants String constants are all consecutive sets of ascii characters including but not limited to dashed numbers and spaces that aren t keywords characters that separate the arguments of a statement identifiers conditions mathematical expressions the declaration operator or the content operator The characters can be escaped with backslash if needed 3 2 Comments Since ScriptEdit is intended to be embedded within the text of another file we do not provide a ScriptEdit specific comment To comment your code use the native comment style in the string constants For example if you are editing an HTML file you would use HTML your comments HTML 2 3 3 Identifiers Names An identifier is a case sensitive sequence of letters digits and underscore The first character cannot be a digit 3 4 Keywords declaration and content operators The following identifiers are keywords that are reserved for specific use as follows The within a line signifies the start of a ScriptEdit command and is usually immediately proceeded by a keyword without any space character seperation file else for write file while next break def if exec calc do gettoken continue The declaration and content operators may be considered a string constant or part of a variable function declaration depending on rules that are specified by their semantics The lexical conventions of each statement are explained along with its semantics 3 5 Conditions Conditions are exclusively used as part of the if and while constructs They evaluate to either true or false Allowable binary operators are Conditions are composed by pairs of statements seperated by the binary operator where each statement evaluates to a string value for comparison Since all variables are identified by their string value only strings are compared Conditional statements can be compounded using the or operators Parentheses can be used to maintain proper associativity within the conditional statement For example var1 var2 var3 var4 var3 var5 3 3 5 1 Parenthesized expressions Expressions enclosed in parentheses have an identical value as an expression written without parentheses Parentheses can be nested as long as they are balanced 3 5 2 Relational operators Operators are meant to compare only strings that can be converted to integer values If strings can t be converted to an integer using these operators can produce undesirable results Operator 3 5 3 Description returns true if the integer value of v1 is greater than the integer value of v2 v1 v2 returns true if the integer value of v1 is greater or equal to the integer value of v2 v1 v2 returns true if the integer value of v1 is less than the integer value of v2 v1 v2 returns true if the integer value of v1 is less or equal than the integer value of v2 v1 v2 returns true if the string v1 is equal to string v2 v1 v2 returns true if the string v1 is NOT equal to string v2 Conditional operators Operator 3 5 4 Use v1 v2 Use cond1 cond2 cond1 cond2 cond1 Description returns true if cond1 and cond2 are both true returns true if either cond1 or cond2 are true returns true if condition cond1 is NOT true Operator precedence Precedence in evaluation is as follows operator associativity left highest left non associative non associative left left right lowest 4 3 6 Other tokens Characters that separate the arguments of a keyword are and The are generally used to denote statement blocks and generally encloses statement or function arguments but variable calls are specified using the characters for different purposes More details are given for each particular statement Mathematical expressions are specific to statement calc and are explained with the function definition 3 7 Statements Statements are executed from beginning of file to end and from left to right Control flow structures such as functions are evaluated in place The basic scripedit statement begins with a keyword followed sometimes by a variable with parentheses and an statement block contained within brackets 4 Semantics Scoping behavior varies dependent on context as described herein However a general rule is that variables in nested scopes inside the current scope can t be modified from outside their nested scope but variables from outer scopes can be accessed using the proper statements 4 1 Variable declaration Variables may be declared and set to a value using one of these two


View Full Document

Columbia COMS W4115 - ScriptEdit Language Reference Manual

Documents in this Course
YOLT

YOLT

13 pages

Lattakia

Lattakia

15 pages

EasyQL

EasyQL

14 pages

Photogram

Photogram

163 pages

Espresso

Espresso

27 pages

NumLang

NumLang

6 pages

EMPATH

EMPATH

14 pages

La Mesa

La Mesa

9 pages

JTemplate

JTemplate

238 pages

MATVEC

MATVEC

4 pages

TONEDEF

TONEDEF

14 pages

SASSi

SASSi

16 pages

JTemplate

JTemplate

39 pages

BATS

BATS

10 pages

Synapse

Synapse

11 pages

c.def

c.def

116 pages

TweaXML

TweaXML

108 pages

Load more
Loading Unlocking...
Login

Join to view ScriptEdit Language Reference Manual and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view ScriptEdit Language Reference Manual and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?