Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Anders Nilsson
OwlCompiler
Commits
e690866e
Commit
e690866e
authored
Jul 17, 2008
by
Anders Nilsson
Browse files
Added value() method to Attributes, which returns a beautified attribute value.
parent
3b2e13a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
CompilerGeneration.jrag
View file @
e690866e
...
...
@@ -421,6 +421,16 @@ aspect GenMisc {
pStream.println(ind(1)+"public String Attribute.name() {");
pStream.println(ind(2)+"return getValue().getSTRING_LITERAL();");
pStream.println(ind(1)+"}");
pStream.println(ind(1)+"public String Attribute.value() {");
pStream.println(ind(2)+"String s = getValue().getSTRING_LITERAL();");
pStream.println(ind(2)+"int hash = s.indexOf('#');");
pStream.println(ind(2)+"int firstCit = s.indexOf('\"');");
pStream.println(ind(2)+"int lastCit = s.lastIndexOf('\"');");
pStream.println(ind(2)+"hash = hash < 0 ? 0 : hash;");
pStream.println(ind(2)+"firstCit = firstCit < 0 ? 0 : firstCit;");
pStream.println(ind(2)+"lastCit = lastCit > firstCit ? lastCit : s.length()-1;");
pStream.println(ind(2)+"return s.substring(Math.max(hash,firstCit)+1,lastCit);");
pStream.println(ind(1)+"}");
// ClassUse.decl()
// pStream.println(ind(1)+"syn lazy Thing ClassUse.decl() {");
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment