Simula Standard: 3.7 Text expressions text-expression = simple-text-expression | if-clause simple-text-expression else text-expression simple-text-expression = text-primary { & text-primary } text-primary = notext | string | variable | function-designator | "(" text-expression ")"A text expression is of type text. It is a rule for obtaining an identification of a text variable. Apart from possible if-clauses, all constituents of a text expression must be of type text.
Each textual occurrence of a non-empty string corresponds to a unique constant main text frame. A given occurrence always references that same frame, while different occurrences of the same non-empty string always reference different text frames.
The empty string ("") is textually equivalent to notext. Simula Standard: 3.7.1 Text concatenation
The operator & permits text concatenation. The simple text expression "TP1 & TP2 & ... & TPn", where TPi is a text primary (1<=i<=n), references a new alterable main frame whose contents is formed by concatenating copies of the frames referenced by TP1, TP2, ... , TPn (in that order). The expression is equivalent to CONCATENATE_n(T1,T2,...,Tn) defined by
text procedure CONCATENATE_ _n(T1,T2,...,Tn); text T1,T2,...,Tn; begin text temp; CONCATENATE_ _n :- temp :- blanks(T1.length+T2.length+ ... +Tn.length); temp.sub(1,t1.length) := T1; temp.sub(1+T1.length,T2.length) := T2; ... temp.sub(1+T1.length+T2.length+... ,Tn.length) := Tn; end;Note: It follows that the text primary constituents of a simple text expression are evaluated in strict lexical order. The evaluation of Ti may influence the result of evaluating Tj, if i<j (due to the specified "by reference" transmission of parameters to the procedures CONCATENATE_n). Observe further that it follows from the syntax (cfr. 3.1.5) that . is evaluated before &, thus the two expressions "T1 & T2.sub(1,2) & T3.main" and "T1 & (T2.sub(1,2)) & (T3.main)" are equivalent.
Link to GitHub: Source File.
- Author:
- Simula Standard, Øystein Myhre Andersen
-
Field Summary
Modifier and TypeFieldDescriptionprivate Expression
The left hand side of &private Expression
The right hand side of &Fields inherited from class simula.compiler.syntaxClass.expression.Expression
backLink, type
Fields inherited from class simula.compiler.syntaxClass.SyntaxClass
lineNumber
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Perform semantic checking.boolean
Returns true if this expression may be used as a statement.Generate Java code for this Syntax Class.toString()
Methods inherited from class simula.compiler.syntaxClass.expression.Expression
acceptExpression, checkCompatibility, evaluate, expectExpression, get, getInt, getNumber, getQualification, getWriteableVariable, printTree, put
Methods inherited from class simula.compiler.syntaxClass.SyntaxClass
ASSERT_SEMANTICS_CHECKED, doDeclarationCoding, doJavaCoding, edIndent, edTreeIndent, IS_SEMANTICS_CHECKED, print, SET_SEMANTICS_CHECKED
-
Field Details
-
lhs
The left hand side of & -
rhs
The right hand side of &
-
-
Constructor Details
-
TextExpression
TextExpression(Expression lhs, Expression rhs) Create a new TextExpression- Parameters:
lhs
- left hand siderhs
- rigth hand side
-
-
Method Details
-
doChecking
public void doChecking()Description copied from class:SyntaxClass
Perform semantic checking.This must be redefined in every subclass.
- Overrides:
doChecking
in classSyntaxClass
-
maybeStatement
public boolean maybeStatement()Description copied from class:Expression
Returns true if this expression may be used as a statement.- Specified by:
maybeStatement
in classExpression
- Returns:
- true if this expression may be used as a statement
-
toJavaCode
Description copied from class:SyntaxClass
Generate Java code for this Syntax Class.- Overrides:
toJavaCode
in classSyntaxClass
- Returns:
- Java code
-
toString
- Overrides:
toString
in classExpression
-