Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
X
XMLSchemaCompiler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anders Nilsson
XMLSchemaCompiler
Commits
5d5dda0a
Commit
5d5dda0a
authored
18 years ago
by
Anders Nilsson
Browse files
Options
Downloads
Patches
Plain Diff
Started to write a prettyprinter
parent
0137d4eb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
PrettyPrint.java
+17
-0
17 additions, 0 deletions
PrettyPrint.java
PrettyPrinter.jrag
+45
-0
45 additions, 0 deletions
PrettyPrinter.jrag
examples/workpiece.x3d
+51
-0
51 additions, 0 deletions
examples/workpiece.x3d
with
113 additions
and
0 deletions
PrettyPrint.java
0 → 100644
+
17
−
0
View file @
5d5dda0a
/*
* Copyright (C) 2006 Anders Nilsson <anders.nilsson@cs.lth.se>
*
* This file is part of OntologyCompiler.
*/
import
AST.Start
;
public
class
PrettyPrint
extends
Parser
{
public
static
void
main
(
String
args
[])
{
Start
ast
=
parse
(
args
);
// Dump the AST
ast
.
prettyPrint
(
" "
,
System
.
out
);
}
}
This diff is collapsed.
Click to expand it.
PrettyPrinter.jrag
0 → 100644
+
45
−
0
View file @
5d5dda0a
// -*-Java-*-
/*
* Copyright (C) 2007 Anders Nilsson <anders.nilsson@cs.lth.se>
*
* This file is part of XmlSchemaCompiler.
*/
import java.io.PrintStream;
aspect PrettyPrinter {
public void ASTNode.prettyPrint(String ind, PrintStream pStream) {
for (int i=0; i<getNumChild(); i++) {
getChild(i).prettyPrint(ind,pStream);
}
}
public void XsElement.prettyPrint(String ind, PrintStream pStream) {
if (hasName()) {
pStream.println(ind+"Element: "+getName());
}
}
}
aspect Misc {
syn String XsElement.getName() {
for (int i=0; i<getNumAttribute(); i++) {
if (getAttribute(i) instanceof Name) {
return getAttribute(i).getAttValue().getSTRING_LITERAL();
}
}
// OK, no name found so let's report that
return "NoNameFound";
}
syn boolean XsElement.hasName() {
for (int i=0; i<getNumAttribute(); i++) {
if (getAttribute(i) instanceof Name) {
return true;
}
}
// OK, no name found so let's report that
return false;
}
}
This diff is collapsed.
Click to expand it.
examples/workpiece.x3d
0 → 100644
+
51
−
0
View file @
5d5dda0a
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment