Repository: bafolts/plantuml-code-generator Branch: main Commit: 76df89e8fd38 Files: 54 Total size: 184.7 KB Directory structure: gitextract_2sumbkdu/ ├── .github/ │ └── workflows/ │ └── main.yml ├── .gitignore ├── LICENSE ├── README.md ├── package.json ├── plantcode ├── scripts/ │ └── build_templates.js ├── src/ │ ├── AbstractClass.js │ ├── Aggregation.js │ ├── Class.js │ ├── Composition.js │ ├── Connection.js │ ├── Extension.js │ ├── Field.js │ ├── Interface.js │ ├── Method.js │ ├── Namespace.js │ ├── Package.js │ ├── Parameter.js │ ├── UMLBlock.js │ ├── plantcode.js │ ├── plantuml.js │ └── plantuml.pegjs ├── templates/ │ ├── coffeescript.hbs │ ├── csharp.hbs │ ├── ecmascript5.hbs │ ├── ecmascript6.hbs │ ├── index.js │ ├── java.hbs │ ├── kotlin.hbs │ ├── php.hbs │ ├── python.hbs │ ├── ruby.hbs │ ├── swift.hbs │ └── typescript.hbs └── tests/ ├── car.coffee ├── car.cs ├── car.java ├── car.js ├── car.js6 ├── car.kt ├── car.pegjs ├── car.php ├── car.py ├── car.rb ├── car.swift ├── car.ts ├── comment-file-simple.java ├── comment-file-simple.pegjs ├── comments-dots.java ├── comments-dots.pegjs ├── integration.js ├── notes-file.java └── notes-file.pegjs ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/workflows/main.yml ================================================ name: CI on: [pull_request, push] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - uses: actions/setup-node@v1 with: node-version: '10.x' - run: npm install - run: npm run build - run: npm test ================================================ FILE: .gitignore ================================================ coverage node_modules .nyc_output/ ================================================ FILE: LICENSE ================================================ The MIT License (MIT) Copyright (c) 2014 Brian Folts Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ # plantcode Provides a command line utility to generate code in various languages given a plantuml class diagram. ## Command line options ```shell Usage: plantcode [options] Generates classfile(s) for the provided PlantUML file specified by and writes to standard output. Options: -l, --language name of the programming language which the produced class files will be written in -o, --out the path to output the file(s) to --show-languages displays all the current supported programming languages for use for with the language option -h, --help print help and exit ``` The currently supported languages are * CoffeeScript (coffeescript) [default] * C# (csharp) * ECMAScript5 (javascript) * ECMAScript6 (javascript2.0) * Java (java) * PHP (php) * Python (python) * Ruby (ruby) * TypeScript (typescript) * Swift (swift) * Kotlin (kotlin) ## PEG.js The most recent version of [PlantUML](http://plantuml.sourceforge.net/) does not have a defined grammar to use with parsing the PlantUML code. Below is a guess as to what the grammer for the language should be, relative to the [PEG.js](https://github.com/dmajda/pegjs) parser. This creates a parser which is then used in the creation of all output files. This grammar should validate to any valid PlantUML file. ``` plantumlfile = items:((noise newline { return null }) / (noise "@startuml" noise newline filelines:umllines noise "@enduml" noise { var UMLBlock = require("./UMLBlock"); return new UMLBlock(filelines) }))* { for (var i = 0; i < items.length; i++) { if (items[i] === null) { items.splice(i, 1); i--; } } return items } umllines = lines:(umlline*) { for (var i = 0; i < lines.length; i++) { if (lines[i]===null) { lines.splice(i, 1); i--; } } return lines; } umlline = propertyset newline { return null } / titleset newline { return null } / noise newline { return null } / commentline { return null } / noteline { return null } / hideline newline { return null } / skinparams newline { return null } / declaration:packagedeclaration newline { return declaration } / declaration:namespacedeclaration newline { return declaration } / declaration:classdeclaration newline { return declaration } / declaration:interfacedeclaration newline { return declaration } / declaration:abstractclassdeclaration newline { return declaration } / declaration:memberdeclaration newline { return declaration } / declaration:connectordeclaration newline { return declaration } hideline = noise "hide empty members" noise skinparams = noise "skinparam" noise [^\r\n]+ connectordeclaration = noise leftObject:objectname noise connectordescription? noise connector:connectortype noise connectordescription? noise rightObject:objectname noise ([:] [^\r\n]+)? { var Connection = require("./Connection"); return new Connection(leftObject, connector, rightObject) } connectordescription = noise ["]([\\]["]/[^"])*["] noise titleset = noise "title " noise [^\r\n]+ noise commentline = noise "'" [^\r\n]+ noise / noise ".." [^\r\n\.]+ ".." noise / noise "--" [^\r\n\-]+ "--" noise / noise "__" [^\r\n\_]+ "__" noise noteline = noise "note " noise [^\r\n]+ noise connectortype = item:extends { return item } / concatenates { var Composition = require("./Composition"); return new Composition() } / aggregates { var Aggregation = require("./Aggregation"); return new Aggregation() } / connectorsize { return null } extends = "<|" connectorsize { var Extension = require("./Extension"); return new Extension(true) } / connectorsize "|>" { var Extension = require("./Extension"); return new Extension(false) } connectorsize = ".." / "-up-" / "-down-" / "-left-" / "-right-" / "---" / "--" / [.] / [-] concatenates = "*" connectorsize / connectorsize [*] aggregates = "o" connectorsize / connectorsize [o] startblock = noise [{] noise endblock = noise [}] propertyset = "setpropname.*" packagedeclaration = "package " objectname startblock newline umllines endblock / "package " objectname newline umllines "end package" abstractclassdeclaration = noise "abstract " noise "class "? noise classname:objectname noise startblock lines:umllines endblock { var AbstractClass = require("./AbstractClass"); return new AbstractClass(classname, lines) } / noise "abstract " noise "class "? noise classname:objectname noise { var AbstractClass = require("./AbstractClass"); return new AbstractClass(classname) } / noise "abstract " noise "class "? noise classname:objectname noise newline noise lines:umllines "end class" { var AbstractClass = require("./AbstractClass"); return new AbstractClass(classname, lines) } noise = [ \t]* newline = [\r\n] / [\n] classdeclaration = noise "class " noise classname:objectname noise startblock lines:umllines endblock { var Class = require("./Class"); return new Class(classname, lines) } / noise "class " noise classname:objectname noise "<<" noise [^>]+ noise ">>" noise { var Class = require("./Class"); return new Class(classname) } / noise "class " noise classname:objectname noise { var Class = require("./Class"); return new Class(classname) } / noise "class " noise classname:objectname noise newline noise lines:umllines "end class" { var Class = require("./Class"); return new Class(classname, lines) } interfacedeclaration = noise "interface " noise interfacename:objectname noise startblock lines:umllines endblock { var Interface = require("./Interface"); return new Interface(interfacename, lines) } / noise "interface " noise interfacename:objectname noise "<<" noise [^>]+ noise ">>" noise { var Interface = require("./Interface"); return new Interface(interfacename) } / noise "interface " noise interfacename:objectname noise { var Interface = require("./Interface"); return new Interface(interfacename) } / noise "interface " noise interfacename:objectname noise newline noise lines:umllines "end interface" { var Interface = require("./Interface"); return new Interface(interfacename, lines) } color = [#][0-9a-fA-F]+ namespacedeclaration = noise "namespace " noise namespacename:objectname noise color? noise startblock lines:umllines endblock { var Namespace = require("./Namespace"); return new Namespace(namespacename, lines) } / noise "namespace " noise namespacename:objectname noise newline umllines "end namespace" { var Namespace = require("./Namespace"); return new Namespace(namespacename) } staticmemberdeclaration = "static " memberdeclaration memberdeclaration = declaration:methoddeclaration { return declaration } / declaration:fielddeclaration { return declaration } fielddeclaration = noise accessortype:accessortype noise returntype:returntype noise membername:membername noise { var Field = require("./Field"); return new Field(accessortype, returntype, membername) } / noise accessortype:accessortype noise membername:membername noise [:] noise returntype:returntype noise { var Field = require("./Field"); return new Field(accessortype, returntype, membername) } / noise accessortype:accessortype noise membername:membername noise { var Field = require("./Field"); return new Field(accessortype, "void", membername) } / noise returntype:returntype noise membername:membername noise { var Field = require("./Field"); return new Field("+", returntype, membername) } / noise membername:membername noise [:] noise returntype:returntype noise { var Field = require("./Field"); return new Field("+", returntype, membername) } methoddeclaration = noise field:fielddeclaration [(] parameters:methodparameters [)] noise [:] noise returntype:returntype noise { var Method = require("./Method"); return new Method(field.getAccessType(), returntype, field.getName(), parameters); } / noise field:fielddeclaration [(] parameters:methodparameters [)] noise { var Method = require("./Method"); return new Method(field.getAccessType(), field.getReturnType(), field.getName(), parameters); } methodparameters = items:methodparameter* { return items; } methodparameter = noise item:returntype membername:([ ] membername)? [,]? { var Parameter = require("./Parameter"); return new Parameter(item, membername ? membername[1] : null); } returntype = items:[^ ,\n\r\t(){}]+ { return items.join("") } objectname = objectname:([A-Za-z_][A-Za-z0-9.]*) { return [objectname[0], objectname[1].join("")].join("") } membername = items:([A-Za-z_][A-Za-z0-9_]*) { return [items[0], items[1].join("")].join("") } accessortype = publicaccessor / privateaccessor / protectedaccessor publicaccessor = [+] privateaccessor = [-] protectedaccessor = [#] ``` ## Goals Initially this project will only run with node.js and output coffeescript classes. The general idea is that, given any PlantUML file, we will be able to generate class files in any output language. Eventually moving on from node.js and supporting other tools to use for conversion. ## Example The current example is very basic and features a common example of a car. ### PlantUML Code: ``` @startuml hide empty members abstract Car { + void setModel(String model) + void setMake(String make) + void setYear(Number) + String getModel() + String getMake() + Number getYear() } class Toyota class Honda class Ford Toyota --|> Car Honda --|> Car Ford --|> Car @enduml ``` ### CoffeeScript Produced: ```coffeescript class Car setModel: (model) -> setMake: (make) -> setYear: (paramX) -> getModel: -> getMake: -> getYear: -> class Toyota extends Car class Honda extends Car class Ford extends Car ``` ### Running: ``` npm install plantcode -l coffescript tests/car.pegjs > tests/car.coffee ``` ### Testing: ``` npm test ``` ### Updating PEGJS grammar: If you update the PEGJS grammar file `src/plantuml.pegjs` you must run this command to update the corresponding `src/plantuml.js` file. ``` npm run build ``` ================================================ FILE: package.json ================================================ { "name": "plantcode", "version": "0.2.2", "description": "PlantUML to class file generator.", "author": "Brian Folts ", "main": "plantcode", "scripts": { "build": "node scripts/build_templates.js && node node_modules/pegjs/bin/pegjs src/plantuml.pegjs src/plantuml.js", "test": "node node_modules/.bin/nyc node tests/integration.js" }, "bin": "plantcode", "repository": { "type": "git", "url": "git://github.com/bafolts/plantuml-code-generator.git" }, "dependencies": { "handlebars": "^4.7.6" }, "devDependencies": { "nyc": "^15.1.0", "pegjs": "^0.9.0" }, "engines": { "node": ">= 0.8" }, "license": "(MIT OR Apache-2.0)" } ================================================ FILE: plantcode ================================================ #!/usr/bin/env node var fs = require("fs"); var hbs = require("handlebars"); var parser = require("./src/plantuml"); var index = require("./src/plantcode"); var templates = require("./templates/index"); var os = require("os"); var options = { language: "typescript", output: null }; var supported_languages = index.getSupportedLanguages(); var args = process.argv.slice(2); // Trim "node" and the script path. if (args.length === 0) { printUsage(); } else { index.convertFile(getArguments()); } function printLanguages() { supported_languages.forEach(function (item) { console.log(item); }) exitSuccess(); } function printUsage() { console.log("Usage: plantcode [options] "); console.log(""); console.log("Generates classfile(s) for the provided PlantUML file specified by and writes to standard output."); console.log(""); console.log("Options:"); console.log(" -l, --language name of the programming language"); console.log(" which the produced class files") console.log(" will be written in"); console.log(" -o, --out the path to output the file(s) to"); console.log(" --show-languages displays all the current supported"); console.log(" programming languages for use") console.log(" for with the language option"); console.log(" -h, --help print help and exit"); exitSuccess(); } function isValidLanguage(language) { return supported_languages.indexOf(language) !== -1; } function getArguments() { while (args.length > 0 && isOption(args[0])) { switch (args[0]) { case "-o": case "--out": nextArg(); if (args.length === 0) { abort("Missing output directory or file for -o/--out option."); } options.output = args[0]; break; case "-l": case "--language": nextArg(); if (args.length === 0) { abort("Missing language of the -l/--language option."); } else if (!isValidLanguage(args[0])) { abort("Invalid language provided."); } options.language = args[0]; break; case "--show-languages": printLanguages(); break; case "-h": case "--help": printUsage(); break; default: abort("Invalid option " + args[0]); break; } nextArg(); } switch (args.length) { case 1: options.input = args[0]; break; default: abort("No input file provided."); } return options; } function exitFailure() { process.exit(1); } function exitSuccess() { process.exit(0); } function abort(message) { for (var i = 0, length = arguments.length; i < length; i++) { console.error(arguments[i]); } exitFailure(); } function isOption(arg) { return (/^-/).test(arg); } function nextArg() { args.shift(); } ================================================ FILE: scripts/build_templates.js ================================================ const fs = require("fs"); const index = require("../src/plantcode"); const supportedLanguages = index.getSupportedLanguages(); let output = "// DO NOT EDIT THIS FILE. GENERATED WITH scripts/build_templates.js\n"; supportedLanguages.forEach(function (supportedLanguage) { let template = fs.readFileSync("./templates/" + supportedLanguage + ".hbs").toString(); template = template.replace(/\$/g, "\\$$"); output += `exports.${supportedLanguage} = \`${template}\`;\n`; }); fs.writeFileSync('./templates/index.js', output); ================================================ FILE: src/AbstractClass.js ================================================ var Class = require("./Class"); class AbstractClass extends Class { getKeyword() { return "abstract class"; } isAbstract() { return true; } } module.exports = AbstractClass; ================================================ FILE: src/Aggregation.js ================================================ module.exports = (function () { var Aggregation = function () { } return Aggregation; })() ================================================ FILE: src/Class.js ================================================ module.exports = (function () { var Field = require("./Field"); var Method = require("./Method"); var Class = function (className, fileLines) { this.cExtends = null; this.fileLines = fileLines || []; this.className = className; this.nNamespace = null; } Class.prototype.getKeyword = function () { return "class"; } Class.prototype.setExtends = function (className) { this.cExtends = className; } Class.prototype.getExtends = function () { return this.cExtends; } Class.prototype.setNamespace = function (namespace) { this.nNamespace = namespace; } Class.prototype.getNamespace = function () { return this.nNamespace; } Class.prototype.isAbstract = function () { return false; } Class.prototype.getName = function () { return this.className; } Class.prototype.hasMethods = function () { for (var i = 0, length = this.fileLines.length; i < length; i++) { if (this.fileLines[i] instanceof Method) { return true; } } return false; } Class.prototype.getMethods = function () { var aResult = []; for (var i = 0, length = this.fileLines.length; i < length; i++) { if (this.fileLines[i] instanceof Method) { aResult.push(this.fileLines[i]); } } return aResult; } Class.prototype.hasFields = function () { for (var i = 0, length = this.fileLines.length; i < length; i++) { if (!(this.fileLines[i] instanceof Method) && this.fileLines[i] instanceof Field) { return true; } } return false; } Class.prototype.getFields = function () { var aResult = []; for (var i = 0, length = this.fileLines.length; i < length; i++) { if (!(this.fileLines[i] instanceof Method) && this.fileLines[i] instanceof Field) { aResult.push(this.fileLines[i]); } } return aResult; } Class.prototype.getFullName = function () { if (this.getNamespace() !== null) { return this.getNamespace().getFullName() + "." + this.getName(); } else { return this.getName(); } } return Class; })() ================================================ FILE: src/Composition.js ================================================ module.exports = (function () { var Composition = function () { } return Composition; })() ================================================ FILE: src/Connection.js ================================================ module.exports = (function () { var Connection = function (leftObject, connector, rightObject) { this.leftObject = leftObject; this.connector = connector; this.pNamespace = null; this.rightObject = rightObject; } Connection.prototype.setNamespace = function (namespace) { this.pNamespace = namespace; } Connection.prototype.getConnector = function () { return this.connector; } Connection.prototype.getNamespace = function () { return this.pNamespace; } return Connection; })() ================================================ FILE: src/Extension.js ================================================ module.exports = (function () { var Extension = function (bIsLeft) { this.bIsLeft = bIsLeft; } Extension.prototype.isLeft = function () { return this.bIsLeft; } return Extension; })() ================================================ FILE: src/Field.js ================================================ module.exports = (function () { var Field = function (accessType, returnType, fieldName) { this.sAccessType = accessType; this.sReturnType = returnType; this.sFieldName = fieldName; } Field.prototype.getAccessType = function () { return this.sAccessType; } Field.prototype.getReturnType = function () { return this.sReturnType; } Field.prototype.getName = function () { return this.sFieldName; } Field.prototype.isPrivate = function () { return this.sAccessType === '-'; } Field.prototype.isProtected = function () { return this.sAccessType === '#'; } Field.prototype.isPublic = function () { return this.sAccessType === '+'; } return Field; })() ================================================ FILE: src/Interface.js ================================================ module.exports = (function () { var Field = require("./Field"); var Method = require("./Method"); var Interface = function (interfaceName, fileLines) { this.cExtends = null; this.fileLines = fileLines || []; this.interfaceName = interfaceName; this.nNamespace = null; } Interface.prototype.getKeyword = function () { return "interface"; } Interface.prototype.setExtends = function (interfaceName) { this.cExtends = interfaceName; } Interface.prototype.getExtends = function () { return this.cExtends; } Interface.prototype.setNamespace = function (namespace) { this.nNamespace = namespace; } Interface.prototype.getNamespace = function () { return this.nNamespace; } Interface.prototype.getName = function () { return this.interfaceName; } Interface.prototype.hasMethods = function () { for (var i = 0, length = this.fileLines.length; i < length; i++) { if (this.fileLines[i] instanceof Method) { return true; } } return false; } Interface.prototype.getMethods = function () { var aResult = []; for (var i = 0, length = this.fileLines.length; i < length; i++) { if (this.fileLines[i] instanceof Method) { aResult.push(this.fileLines[i]); } } return aResult; } Interface.prototype.hasFields = function () { for (var i = 0, length = this.fileLines.length; i < length; i++) { if (!(this.fileLines[i] instanceof Method) && this.fileLines[i] instanceof Field) { return true; } } return false; } Interface.prototype.getFields = function () { var aResult = []; for (var i = 0, length = this.fileLines.length; i < length; i++) { if (!(this.fileLines[i] instanceof Method) && this.fileLines[i] instanceof Field) { aResult.push(this.fileLines[i]); } } return aResult; } Interface.prototype.getFullName = function () { if (this.getNamespace() !== null) { return this.getNamespace().getFullName() + "." + this.getName(); } else { return this.getName(); } } return Interface; })() ================================================ FILE: src/Method.js ================================================ var Field = require("./Field"); class Method extends Field { constructor (accessType, returnType, fieldName, aParameters) { super(accessType, returnType, fieldName); this.aParameters = aParameters; } needsReturnStatement() { return this.sReturnType !== "void"; } getParameters() { return this.aParameters; } } module.exports = Method; ================================================ FILE: src/Namespace.js ================================================ module.exports = (function () { var Class = require("./Class"); var AbstractClass = require("./AbstractClass"); var Connection = require("./Connection"); var Namespace = function (namespaceName, fileLines) { this.namespaceName = namespaceName; this.aItems = fileLines; this.nNamespace = null; this.init(); } Namespace.prototype.getName = function () { return this.namespaceName; } Namespace.prototype.getItems = function () { return this.aItems; } Namespace.prototype.setNamespace = function (namespace) { this.nNamespace = namespace; } Namespace.prototype.getNamespace = function () { return this.nNamespace; } Namespace.prototype.getFullName = function () { var aFull = [this.getName()]; var nSpace = this.getNamespace(); while (nSpace !== null) { aFull.unshift(nSpace.getName()); nSpace = nSpace.getNamespace(); } return aFull.join("."); } Namespace.prototype.init = function () { for (var i = 0, length = this.aItems.length; i < length; i++) { if (this.aItems[i] instanceof Namespace) { this.aItems[i].setNamespace(this); } else if (this.aItems[i] instanceof Class || this.aItems[i] instanceof AbstractClass) { this.aItems[i].setNamespace(this); } else if (this.aItems[i] instanceof Connection) { this.aItems[i].setNamespace(this); } } } return Namespace; })() ================================================ FILE: src/Package.js ================================================ module.exports = (function () { var Package = function (namespaceName, fileLines) { this.namespaceName = namespaceName; this.fileLines = fileLines; } return Package; })() ================================================ FILE: src/Parameter.js ================================================ module.exports = (function () { var Parameter = function (returnType, memberName) { this.sReturnType = returnType; this.sParameterName = memberName; } Parameter.prototype.getReturnType = function () { return this.sReturnType; } Parameter.prototype.getName = function () { return this.sParameterName; } return Parameter; })() ================================================ FILE: src/UMLBlock.js ================================================ module.exports = (function () { var Namespace = require("./Namespace"); var Class = require("./Class"); var AbstractClass = require("./AbstractClass"); var Connection = require("./Connection"); var Package = require("./Package"); var Extension = require("./Extension"); var Interface = require("./Interface"); var UMLBlock = function (fileLines) { this.aNamespaces = []; // contains all defined namespaces this.aPackages = []; // contains all defined packages this.aClasses = []; // contains all defined classes this.aConnections = []; // contains all defined connections this.aItems = fileLines; this.populateGlobals(this); this.setupConnections(); } UMLBlock.prototype.getClasses = function () { return this.aClasses; } UMLBlock.prototype.getItems = function () { return this.aItems; } UMLBlock.prototype.setupConnections = function () { for (var i = 0, length = this.aConnections.length; i < length; i++) { this.setupConnection(this.aConnections[i]); } } UMLBlock.prototype.setupConnection = function (connection) { var cLeft = null; var cRight = null; for (var i = 0, length = this.aClasses.length; i < length; i++) { if (connection.leftObject.indexOf(".") !== -1) { if (connection.leftObject.indexOf(".") === 0) { if (this.aClasses[i].getNamespace()===null && this.aClasses[i].getName() === connection.leftObject.substring(1)) { cLeft = this.aClasses[i]; } } else { if (this.aClasses[i].getFullName() === connection.leftObject) { cLeft = this.aClasses[i]; } } } else if (this.aClasses[i].getName() === connection.leftObject && this.aClasses[i].getNamespace() === connection.getNamespace()) { cLeft = this.aClasses[i]; } if (connection.rightObject.indexOf(".") !== -1) { if (connection.rightObject.indexOf(".") === 0) { if (this.aClasses[i].getNamespace()===null && this.aClasses[i].getName() === connection.rightObject.substring(1)) { cRight = this.aClasses[i]; } } else { if (this.aClasses[i].getFullName() === connection.rightObject) { cRight = this.aClasses[i]; } } } else if (this.aClasses[i].getName() === connection.rightObject && this.aClasses[i].getNamespace() === connection.getNamespace()) { cRight = this.aClasses[i]; } } if (cLeft !== null && cRight !== null) { if (connection.getConnector() instanceof Extension) { if (connection.getConnector().isLeft()) { cRight.setExtends(cLeft); } else { cLeft.setExtends(cRight); } } } } UMLBlock.prototype.populateGlobals = function (item) { var items = item.getItems(); for (var i = 0, length = items.length; i < length; i++) { if (items[i] instanceof Namespace) { this.aNamespaces.push(items[i]); this.populateGlobals(items[i]); } else if (items[i] instanceof Class || items[i] instanceof AbstractClass || items[i] instanceof Interface) { this.aClasses.push(items[i]); } else if (items[i] instanceof Package) { this.aPackages.push(items[i]); this.populateGlobals(items[i]); } else if (items[i] instanceof Connection) { this.aConnections.push(items[i]); } else { throw "Unknown type"; } } } return UMLBlock; })() ================================================ FILE: src/plantcode.js ================================================ var fs = require("fs"); var hbs = require("handlebars"); var parser = require("./plantuml"); var os = require("os"); var templates = require("../templates/index"); var supported_languages = ["coffeescript", "csharp", "ecmascript5", "ecmascript6", "java", "php", "python", "ruby", "typescript", "swift", "kotlin"]; hbs.registerHelper('if_ne', function(a, b, opts) { if (a() != b) { return opts.fn(this); } else { return opts.inverse(this); } }); // sReturnType Check hbs.registerHelper('if_ne2', function(a, b, opts) { if (a["sReturnType"] != b) { return opts.fn(this); } else { return opts.inverse(this); } }); // Workaround for an apparent bug in Handlebars: functions are not called with the parent scope // as context. // // Here the getFullName is found in the parent scope (Class), but it is called with the current // scope (Field) as context: // // {{#each getFields}} // {{../getFullName}} // {{/each}} // // The following helper works around it: // // {{#each getFields}} // {{#call ../this ../getFullName}} // {{/each}} hbs.registerHelper('call', function (context, member, options) { return member.call(context); }); function convertFile(config) { fs.readFile(config.input, { encoding: "UTF-8" }, function (err, data) { if (err === null) { var output = convertText(config, data); if (config.output === null) { console.log(output); } else { fs.writeFile(config.output, output, function (err) { if (err !== null) { console.error("Unable to write output file for " + config.output + "."); } }) } } else { console.error("Unable to read input file."); } }); } function getSupportedLanguages() { return supported_languages; } function convertText(config, data) { try { var aUMLBlocks = parser.parse(data); } catch(e) { console.error("Error parsing input file: ", config.input, e); return; } var data = templates[config.language]; if (data === undefined) { console.error("Unable to read template file for " + config.language + "."); return; } return processTemplateFile(config, data, aUMLBlocks); } function processTemplateFile(config, templateData, dictionary) { var template = hbs.compile(templateData); var output = ""; dictionary.forEach(function (element) { element.getClasses().forEach(function (element) { output += template(element, { allowedProtoMethods: { "getExtends": true, "getFields": true, "getFullName": true, "getKeyword": true, "getMethods": true, "getName": true, "getParameters": true, "getReturnType": true, "hasFields": true, "hasMethods": true, "isPrivate": true, "isProtected": true, "isPublic": true, "needsReturnStatement": true } }) + os.EOL + os.EOL; }) }) return output; } exports.getSupportedLanguages = getSupportedLanguages; exports.convertFile = convertFile; exports.convertText = convertText; ================================================ FILE: src/plantuml.js ================================================ module.exports = (function() { "use strict"; /* * Generated by PEG.js 0.9.0. * * http://pegjs.org/ */ function peg$subclass(child, parent) { function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); } function peg$SyntaxError(message, expected, found, location) { this.message = message; this.expected = expected; this.found = found; this.location = location; this.name = "SyntaxError"; if (typeof Error.captureStackTrace === "function") { Error.captureStackTrace(this, peg$SyntaxError); } } peg$subclass(peg$SyntaxError, Error); function peg$parse(input) { var options = arguments.length > 1 ? arguments[1] : {}, parser = this, peg$FAILED = {}, peg$startRuleFunctions = { plantumlfile: peg$parseplantumlfile }, peg$startRuleFunction = peg$parseplantumlfile, peg$c0 = function() { return null }, peg$c1 = "@startuml", peg$c2 = { type: "literal", value: "@startuml", description: "\"@startuml\"" }, peg$c3 = "@enduml", peg$c4 = { type: "literal", value: "@enduml", description: "\"@enduml\"" }, peg$c5 = function(filelines) { var UMLBlock = require("./UMLBlock"); return new UMLBlock(filelines) }, peg$c6 = function(items) { for (var i = 0; i < items.length; i++) { if (items[i] === null) { items.splice(i, 1); i--; } } return items }, peg$c7 = function(lines) { for (var i = 0; i < lines.length; i++) { if (lines[i]===null) { lines.splice(i, 1); i--; } } return lines; }, peg$c8 = function(declaration) { return declaration }, peg$c9 = "hide empty members", peg$c10 = { type: "literal", value: "hide empty members", description: "\"hide empty members\"" }, peg$c11 = "skinparam", peg$c12 = { type: "literal", value: "skinparam", description: "\"skinparam\"" }, peg$c13 = /^[^\r\n]/, peg$c14 = { type: "class", value: "[^\\r\\n]", description: "[^\\r\\n]" }, peg$c15 = /^[:]/, peg$c16 = { type: "class", value: "[:]", description: "[:]" }, peg$c17 = function(leftObject, connector, rightObject) { var Connection = require("./Connection"); return new Connection(leftObject, connector, rightObject) }, peg$c18 = /^["]/, peg$c19 = { type: "class", value: "[\"]", description: "[\"]" }, peg$c20 = /^[\\]/, peg$c21 = { type: "class", value: "[\\\\]", description: "[\\\\]" }, peg$c22 = /^[^"]/, peg$c23 = { type: "class", value: "[^\"]", description: "[^\"]" }, peg$c24 = "title ", peg$c25 = { type: "literal", value: "title ", description: "\"title \"" }, peg$c26 = "'", peg$c27 = { type: "literal", value: "'", description: "\"'\"" }, peg$c28 = "..", peg$c29 = { type: "literal", value: "..", description: "\"..\"" }, peg$c30 = /^[^\r\n.]/, peg$c31 = { type: "class", value: "[^\\r\\n\\.]", description: "[^\\r\\n\\.]" }, peg$c32 = "--", peg$c33 = { type: "literal", value: "--", description: "\"--\"" }, peg$c34 = /^[^\r\n\-]/, peg$c35 = { type: "class", value: "[^\\r\\n\\-]", description: "[^\\r\\n\\-]" }, peg$c36 = "__", peg$c37 = { type: "literal", value: "__", description: "\"__\"" }, peg$c38 = /^[^\r\n_]/, peg$c39 = { type: "class", value: "[^\\r\\n\\_]", description: "[^\\r\\n\\_]" }, peg$c40 = "note ", peg$c41 = { type: "literal", value: "note ", description: "\"note \"" }, peg$c42 = function(item) { return item }, peg$c43 = function() { var Composition = require("./Composition"); return new Composition() }, peg$c44 = function() { var Aggregation = require("./Aggregation"); return new Aggregation() }, peg$c45 = "<|", peg$c46 = { type: "literal", value: "<|", description: "\"<|\"" }, peg$c47 = function() { var Extension = require("./Extension"); return new Extension(true) }, peg$c48 = "|>", peg$c49 = { type: "literal", value: "|>", description: "\"|>\"" }, peg$c50 = function() { var Extension = require("./Extension"); return new Extension(false) }, peg$c51 = "-up-", peg$c52 = { type: "literal", value: "-up-", description: "\"-up-\"" }, peg$c53 = "-down-", peg$c54 = { type: "literal", value: "-down-", description: "\"-down-\"" }, peg$c55 = "-left-", peg$c56 = { type: "literal", value: "-left-", description: "\"-left-\"" }, peg$c57 = "-right-", peg$c58 = { type: "literal", value: "-right-", description: "\"-right-\"" }, peg$c59 = "---", peg$c60 = { type: "literal", value: "---", description: "\"---\"" }, peg$c61 = /^[.]/, peg$c62 = { type: "class", value: "[.]", description: "[.]" }, peg$c63 = /^[\-]/, peg$c64 = { type: "class", value: "[-]", description: "[-]" }, peg$c65 = "*", peg$c66 = { type: "literal", value: "*", description: "\"*\"" }, peg$c67 = /^[*]/, peg$c68 = { type: "class", value: "[*]", description: "[*]" }, peg$c69 = "o", peg$c70 = { type: "literal", value: "o", description: "\"o\"" }, peg$c71 = /^[o]/, peg$c72 = { type: "class", value: "[o]", description: "[o]" }, peg$c73 = /^[{]/, peg$c74 = { type: "class", value: "[{]", description: "[{]" }, peg$c75 = /^[}]/, peg$c76 = { type: "class", value: "[}]", description: "[}]" }, peg$c77 = "setpropname.*", peg$c78 = { type: "literal", value: "setpropname.*", description: "\"setpropname.*\"" }, peg$c79 = "package ", peg$c80 = { type: "literal", value: "package ", description: "\"package \"" }, peg$c81 = "end package", peg$c82 = { type: "literal", value: "end package", description: "\"end package\"" }, peg$c83 = "abstract ", peg$c84 = { type: "literal", value: "abstract ", description: "\"abstract \"" }, peg$c85 = "class ", peg$c86 = { type: "literal", value: "class ", description: "\"class \"" }, peg$c87 = function(classname, lines) { var AbstractClass = require("./AbstractClass"); return new AbstractClass(classname, lines) }, peg$c88 = function(classname) { var AbstractClass = require("./AbstractClass"); return new AbstractClass(classname) }, peg$c89 = "end class", peg$c90 = { type: "literal", value: "end class", description: "\"end class\"" }, peg$c91 = /^[ \t]/, peg$c92 = { type: "class", value: "[ \\t]", description: "[ \\t]" }, peg$c93 = /^[\r\n]/, peg$c94 = { type: "class", value: "[\\r\\n]", description: "[\\r\\n]" }, peg$c95 = /^[\n]/, peg$c96 = { type: "class", value: "[\\n]", description: "[\\n]" }, peg$c97 = function(classname, lines) { var Class = require("./Class"); return new Class(classname, lines) }, peg$c98 = "<<", peg$c99 = { type: "literal", value: "<<", description: "\"<<\"" }, peg$c100 = /^[^>]/, peg$c101 = { type: "class", value: "[^>]", description: "[^>]" }, peg$c102 = ">>", peg$c103 = { type: "literal", value: ">>", description: "\">>\"" }, peg$c104 = function(classname) { var Class = require("./Class"); return new Class(classname) }, peg$c105 = "interface ", peg$c106 = { type: "literal", value: "interface ", description: "\"interface \"" }, peg$c107 = function(interfacename, lines) { var Interface = require("./Interface"); return new Interface(interfacename, lines) }, peg$c108 = function(interfacename) { var Interface = require("./Interface"); return new Interface(interfacename) }, peg$c109 = "end interface", peg$c110 = { type: "literal", value: "end interface", description: "\"end interface\"" }, peg$c111 = function(interfacename, lines) { var Interface = require("./Interface"); return new Interface(interfacename, lines) }, peg$c112 = /^[#]/, peg$c113 = { type: "class", value: "[#]", description: "[#]" }, peg$c114 = /^[0-9a-fA-F]/, peg$c115 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" }, peg$c116 = "namespace ", peg$c117 = { type: "literal", value: "namespace ", description: "\"namespace \"" }, peg$c118 = function(namespacename, lines) { var Namespace = require("./Namespace"); return new Namespace(namespacename, lines) }, peg$c119 = "end namespace", peg$c120 = { type: "literal", value: "end namespace", description: "\"end namespace\"" }, peg$c121 = function(namespacename) { var Namespace = require("./Namespace"); return new Namespace(namespacename) }, peg$c122 = "static ", peg$c123 = { type: "literal", value: "static ", description: "\"static \"" }, peg$c124 = function(accessortype, returntype, membername) { var Field = require("./Field"); return new Field(accessortype, returntype, membername) }, peg$c125 = function(accessortype, membername, returntype) { var Field = require("./Field"); return new Field(accessortype, returntype, membername) }, peg$c126 = function(accessortype, membername) { var Field = require("./Field"); return new Field(accessortype, "void", membername) }, peg$c127 = function(returntype, membername) { var Field = require("./Field"); return new Field("+", returntype, membername) }, peg$c128 = function(membername, returntype) { var Field = require("./Field"); return new Field("+", returntype, membername) }, peg$c129 = /^[(]/, peg$c130 = { type: "class", value: "[(]", description: "[(]" }, peg$c131 = /^[)]/, peg$c132 = { type: "class", value: "[)]", description: "[)]" }, peg$c133 = function(field, parameters, returntype) { var Method = require("./Method"); return new Method(field.getAccessType(), returntype, field.getName(), parameters); }, peg$c134 = function(field, parameters) { var Method = require("./Method"); return new Method(field.getAccessType(), field.getReturnType(), field.getName(), parameters); }, peg$c135 = function(items) { return items; }, peg$c136 = /^[ ]/, peg$c137 = { type: "class", value: "[ ]", description: "[ ]" }, peg$c138 = /^[,]/, peg$c139 = { type: "class", value: "[,]", description: "[,]" }, peg$c140 = function(item, membername) { var Parameter = require("./Parameter"); return new Parameter(item, membername ? membername[1] : null); }, peg$c141 = /^[^ ,\n\r\t(){}]/, peg$c142 = { type: "class", value: "[^ ,\\n\\r\\t(){}]", description: "[^ ,\\n\\r\\t(){}]" }, peg$c143 = function(items) { return items.join("") }, peg$c144 = /^[A-Za-z_]/, peg$c145 = { type: "class", value: "[A-Za-z_]", description: "[A-Za-z_]" }, peg$c146 = /^[A-Za-z0-9.]/, peg$c147 = { type: "class", value: "[A-Za-z0-9.]", description: "[A-Za-z0-9.]" }, peg$c148 = function(objectname) { return [objectname[0], objectname[1].join("")].join("") }, peg$c149 = /^[A-Za-z0-9_]/, peg$c150 = { type: "class", value: "[A-Za-z0-9_]", description: "[A-Za-z0-9_]" }, peg$c151 = function(items) { return [items[0], items[1].join("")].join("") }, peg$c152 = /^[+]/, peg$c153 = { type: "class", value: "[+]", description: "[+]" }, peg$currPos = 0, peg$savedPos = 0, peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }], peg$maxFailPos = 0, peg$maxFailExpected = [], peg$silentFails = 0, peg$result; if ("startRule" in options) { if (!(options.startRule in peg$startRuleFunctions)) { throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); } peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; } function text() { return input.substring(peg$savedPos, peg$currPos); } function location() { return peg$computeLocation(peg$savedPos, peg$currPos); } function expected(description) { throw peg$buildException( null, [{ type: "other", description: description }], input.substring(peg$savedPos, peg$currPos), peg$computeLocation(peg$savedPos, peg$currPos) ); } function error(message) { throw peg$buildException( message, null, input.substring(peg$savedPos, peg$currPos), peg$computeLocation(peg$savedPos, peg$currPos) ); } function peg$computePosDetails(pos) { var details = peg$posDetailsCache[pos], p, ch; if (details) { return details; } else { p = pos - 1; while (!peg$posDetailsCache[p]) { p--; } details = peg$posDetailsCache[p]; details = { line: details.line, column: details.column, seenCR: details.seenCR }; while (p < pos) { ch = input.charAt(p); if (ch === "\n") { if (!details.seenCR) { details.line++; } details.column = 1; details.seenCR = false; } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { details.line++; details.column = 1; details.seenCR = true; } else { details.column++; details.seenCR = false; } p++; } peg$posDetailsCache[pos] = details; return details; } } function peg$computeLocation(startPos, endPos) { var startPosDetails = peg$computePosDetails(startPos), endPosDetails = peg$computePosDetails(endPos); return { start: { offset: startPos, line: startPosDetails.line, column: startPosDetails.column }, end: { offset: endPos, line: endPosDetails.line, column: endPosDetails.column } }; } function peg$fail(expected) { if (peg$currPos < peg$maxFailPos) { return; } if (peg$currPos > peg$maxFailPos) { peg$maxFailPos = peg$currPos; peg$maxFailExpected = []; } peg$maxFailExpected.push(expected); } function peg$buildException(message, expected, found, location) { function cleanupExpected(expected) { var i = 1; expected.sort(function(a, b) { if (a.description < b.description) { return -1; } else if (a.description > b.description) { return 1; } else { return 0; } }); while (i < expected.length) { if (expected[i - 1] === expected[i]) { expected.splice(i, 1); } else { i++; } } } function buildMessage(expected, found) { function stringEscape(s) { function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); } return s .replace(/\\/g, '\\\\') .replace(/"/g, '\\"') .replace(/\x08/g, '\\b') .replace(/\t/g, '\\t') .replace(/\n/g, '\\n') .replace(/\f/g, '\\f') .replace(/\r/g, '\\r') .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); }) .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); }) .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); }); } var expectedDescs = new Array(expected.length), expectedDesc, foundDesc, i; for (i = 0; i < expected.length; i++) { expectedDescs[i] = expected[i].description; } expectedDesc = expected.length > 1 ? expectedDescs.slice(0, -1).join(", ") + " or " + expectedDescs[expected.length - 1] : expectedDescs[0]; foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input"; return "Expected " + expectedDesc + " but " + foundDesc + " found."; } if (expected !== null) { cleanupExpected(expected); } return new peg$SyntaxError( message !== null ? message : buildMessage(expected, found), expected, found, location ); } function peg$parseplantumlfile() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10; s0 = peg$currPos; s1 = []; s2 = peg$currPos; s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { s4 = peg$parsenewline(); if (s4 !== peg$FAILED) { peg$savedPos = s2; s3 = peg$c0(); s2 = s3; } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } if (s2 === peg$FAILED) { s2 = peg$currPos; s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { if (input.substr(peg$currPos, 9) === peg$c1) { s4 = peg$c1; peg$currPos += 9; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c2); } } if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { s6 = peg$parsenewline(); if (s6 !== peg$FAILED) { s7 = peg$parseumllines(); if (s7 !== peg$FAILED) { s8 = peg$parsenoise(); if (s8 !== peg$FAILED) { if (input.substr(peg$currPos, 7) === peg$c3) { s9 = peg$c3; peg$currPos += 7; } else { s9 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c4); } } if (s9 !== peg$FAILED) { s10 = peg$parsenoise(); if (s10 !== peg$FAILED) { peg$savedPos = s2; s3 = peg$c5(s7); s2 = s3; } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } } while (s2 !== peg$FAILED) { s1.push(s2); s2 = peg$currPos; s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { s4 = peg$parsenewline(); if (s4 !== peg$FAILED) { peg$savedPos = s2; s3 = peg$c0(); s2 = s3; } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } if (s2 === peg$FAILED) { s2 = peg$currPos; s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { if (input.substr(peg$currPos, 9) === peg$c1) { s4 = peg$c1; peg$currPos += 9; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c2); } } if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { s6 = peg$parsenewline(); if (s6 !== peg$FAILED) { s7 = peg$parseumllines(); if (s7 !== peg$FAILED) { s8 = peg$parsenoise(); if (s8 !== peg$FAILED) { if (input.substr(peg$currPos, 7) === peg$c3) { s9 = peg$c3; peg$currPos += 7; } else { s9 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c4); } } if (s9 !== peg$FAILED) { s10 = peg$parsenoise(); if (s10 !== peg$FAILED) { peg$savedPos = s2; s3 = peg$c5(s7); s2 = s3; } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } } } if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c6(s1); } s0 = s1; return s0; } function peg$parseumllines() { var s0, s1, s2; s0 = peg$currPos; s1 = []; s2 = peg$parseumlline(); while (s2 !== peg$FAILED) { s1.push(s2); s2 = peg$parseumlline(); } if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c7(s1); } s0 = s1; return s0; } function peg$parseumlline() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$parsepropertyset(); if (s1 !== peg$FAILED) { s2 = peg$parsenewline(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c0(); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsetitleset(); if (s1 !== peg$FAILED) { s2 = peg$parsenewline(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c0(); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { s2 = peg$parsenewline(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c0(); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsecommentline(); if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c0(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsenoteline(); if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c0(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsehideline(); if (s1 !== peg$FAILED) { s2 = peg$parsenewline(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c0(); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parseskinparams(); if (s1 !== peg$FAILED) { s2 = peg$parsenewline(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c0(); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsepackagedeclaration(); if (s1 !== peg$FAILED) { s2 = peg$parsenewline(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c8(s1); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsenamespacedeclaration(); if (s1 !== peg$FAILED) { s2 = peg$parsenewline(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c8(s1); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parseclassdeclaration(); if (s1 !== peg$FAILED) { s2 = peg$parsenewline(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c8(s1); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parseinterfacedeclaration(); if (s1 !== peg$FAILED) { s2 = peg$parsenewline(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c8(s1); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parseabstractclassdeclaration(); if (s1 !== peg$FAILED) { s2 = peg$parsenewline(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c8(s1); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsememberdeclaration(); if (s1 !== peg$FAILED) { s2 = peg$parsenewline(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c8(s1); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parseconnectordeclaration(); if (s1 !== peg$FAILED) { s2 = peg$parsenewline(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c8(s1); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } } } } } } } } } } } } } return s0; } function peg$parsehideline() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 18) === peg$c9) { s2 = peg$c9; peg$currPos += 18; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c10); } } if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { s1 = [s1, s2, s3]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseskinparams() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 9) === peg$c11) { s2 = peg$c11; peg$currPos += 9; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c12); } } if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { s4 = []; if (peg$c13.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c14); } } if (s5 !== peg$FAILED) { while (s5 !== peg$FAILED) { s4.push(s5); if (peg$c13.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c14); } } } } else { s4 = peg$FAILED; } if (s4 !== peg$FAILED) { s1 = [s1, s2, s3, s4]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseconnectordeclaration() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15; s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { s2 = peg$parseobjectname(); if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { s4 = peg$parseconnectordescription(); if (s4 === peg$FAILED) { s4 = null; } if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { s6 = peg$parseconnectortype(); if (s6 !== peg$FAILED) { s7 = peg$parsenoise(); if (s7 !== peg$FAILED) { s8 = peg$parseconnectordescription(); if (s8 === peg$FAILED) { s8 = null; } if (s8 !== peg$FAILED) { s9 = peg$parsenoise(); if (s9 !== peg$FAILED) { s10 = peg$parseobjectname(); if (s10 !== peg$FAILED) { s11 = peg$parsenoise(); if (s11 !== peg$FAILED) { s12 = peg$currPos; if (peg$c15.test(input.charAt(peg$currPos))) { s13 = input.charAt(peg$currPos); peg$currPos++; } else { s13 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c16); } } if (s13 !== peg$FAILED) { s14 = []; if (peg$c13.test(input.charAt(peg$currPos))) { s15 = input.charAt(peg$currPos); peg$currPos++; } else { s15 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c14); } } if (s15 !== peg$FAILED) { while (s15 !== peg$FAILED) { s14.push(s15); if (peg$c13.test(input.charAt(peg$currPos))) { s15 = input.charAt(peg$currPos); peg$currPos++; } else { s15 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c14); } } } } else { s14 = peg$FAILED; } if (s14 !== peg$FAILED) { s13 = [s13, s14]; s12 = s13; } else { peg$currPos = s12; s12 = peg$FAILED; } } else { peg$currPos = s12; s12 = peg$FAILED; } if (s12 === peg$FAILED) { s12 = null; } if (s12 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c17(s2, s6, s10); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseconnectordescription() { var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (peg$c18.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c19); } } if (s2 !== peg$FAILED) { s3 = []; s4 = peg$currPos; if (peg$c20.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c21); } } if (s5 !== peg$FAILED) { if (peg$c18.test(input.charAt(peg$currPos))) { s6 = input.charAt(peg$currPos); peg$currPos++; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c19); } } if (s6 !== peg$FAILED) { s5 = [s5, s6]; s4 = s5; } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } if (s4 === peg$FAILED) { if (peg$c22.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c23); } } } while (s4 !== peg$FAILED) { s3.push(s4); s4 = peg$currPos; if (peg$c20.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c21); } } if (s5 !== peg$FAILED) { if (peg$c18.test(input.charAt(peg$currPos))) { s6 = input.charAt(peg$currPos); peg$currPos++; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c19); } } if (s6 !== peg$FAILED) { s5 = [s5, s6]; s4 = s5; } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } if (s4 === peg$FAILED) { if (peg$c22.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c23); } } } } if (s3 !== peg$FAILED) { if (peg$c18.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c19); } } if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { s1 = [s1, s2, s3, s4, s5]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsetitleset() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 6) === peg$c24) { s2 = peg$c24; peg$currPos += 6; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c25); } } if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { s4 = []; if (peg$c13.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c14); } } if (s5 !== peg$FAILED) { while (s5 !== peg$FAILED) { s4.push(s5); if (peg$c13.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c14); } } } } else { s4 = peg$FAILED; } if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { s1 = [s1, s2, s3, s4, s5]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsecommentline() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 39) { s2 = peg$c26; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c27); } } if (s2 !== peg$FAILED) { s3 = []; if (peg$c13.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c14); } } if (s4 !== peg$FAILED) { while (s4 !== peg$FAILED) { s3.push(s4); if (peg$c13.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c14); } } } } else { s3 = peg$FAILED; } if (s3 !== peg$FAILED) { s4 = peg$parsenoise(); if (s4 !== peg$FAILED) { s1 = [s1, s2, s3, s4]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c28) { s2 = peg$c28; peg$currPos += 2; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c29); } } if (s2 !== peg$FAILED) { s3 = []; if (peg$c30.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c31); } } if (s4 !== peg$FAILED) { while (s4 !== peg$FAILED) { s3.push(s4); if (peg$c30.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c31); } } } } else { s3 = peg$FAILED; } if (s3 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c28) { s4 = peg$c28; peg$currPos += 2; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c29); } } if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { s1 = [s1, s2, s3, s4, s5]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c32) { s2 = peg$c32; peg$currPos += 2; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c33); } } if (s2 !== peg$FAILED) { s3 = []; if (peg$c34.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c35); } } if (s4 !== peg$FAILED) { while (s4 !== peg$FAILED) { s3.push(s4); if (peg$c34.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c35); } } } } else { s3 = peg$FAILED; } if (s3 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c32) { s4 = peg$c32; peg$currPos += 2; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c33); } } if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { s1 = [s1, s2, s3, s4, s5]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c36) { s2 = peg$c36; peg$currPos += 2; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c37); } } if (s2 !== peg$FAILED) { s3 = []; if (peg$c38.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c39); } } if (s4 !== peg$FAILED) { while (s4 !== peg$FAILED) { s3.push(s4); if (peg$c38.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c39); } } } } else { s3 = peg$FAILED; } if (s3 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c36) { s4 = peg$c36; peg$currPos += 2; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c37); } } if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { s1 = [s1, s2, s3, s4, s5]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } } } return s0; } function peg$parsenoteline() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 5) === peg$c40) { s2 = peg$c40; peg$currPos += 5; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c41); } } if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { s4 = []; if (peg$c13.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c14); } } if (s5 !== peg$FAILED) { while (s5 !== peg$FAILED) { s4.push(s5); if (peg$c13.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c14); } } } } else { s4 = peg$FAILED; } if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { s1 = [s1, s2, s3, s4, s5]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseconnectortype() { var s0, s1; s0 = peg$currPos; s1 = peg$parseextends(); if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c42(s1); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parseconcatenates(); if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c43(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parseaggregates(); if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c44(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parseconnectorsize(); if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c0(); } s0 = s1; } } } return s0; } function peg$parseextends() { var s0, s1, s2; s0 = peg$currPos; if (input.substr(peg$currPos, 2) === peg$c45) { s1 = peg$c45; peg$currPos += 2; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c46); } } if (s1 !== peg$FAILED) { s2 = peg$parseconnectorsize(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c47(); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parseconnectorsize(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c48) { s2 = peg$c48; peg$currPos += 2; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c49); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c50(); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } return s0; } function peg$parseconnectorsize() { var s0; if (input.substr(peg$currPos, 2) === peg$c28) { s0 = peg$c28; peg$currPos += 2; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c29); } } if (s0 === peg$FAILED) { if (input.substr(peg$currPos, 4) === peg$c51) { s0 = peg$c51; peg$currPos += 4; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c52); } } if (s0 === peg$FAILED) { if (input.substr(peg$currPos, 6) === peg$c53) { s0 = peg$c53; peg$currPos += 6; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c54); } } if (s0 === peg$FAILED) { if (input.substr(peg$currPos, 6) === peg$c55) { s0 = peg$c55; peg$currPos += 6; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c56); } } if (s0 === peg$FAILED) { if (input.substr(peg$currPos, 7) === peg$c57) { s0 = peg$c57; peg$currPos += 7; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c58); } } if (s0 === peg$FAILED) { if (input.substr(peg$currPos, 3) === peg$c59) { s0 = peg$c59; peg$currPos += 3; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c60); } } if (s0 === peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c32) { s0 = peg$c32; peg$currPos += 2; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c33); } } if (s0 === peg$FAILED) { if (peg$c61.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c62); } } if (s0 === peg$FAILED) { if (peg$c63.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c64); } } } } } } } } } } return s0; } function peg$parseconcatenates() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 42) { s1 = peg$c65; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c66); } } if (s1 !== peg$FAILED) { s2 = peg$parseconnectorsize(); if (s2 !== peg$FAILED) { s1 = [s1, s2]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parseconnectorsize(); if (s1 !== peg$FAILED) { if (peg$c67.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c68); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } return s0; } function peg$parseaggregates() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 111) { s1 = peg$c69; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c70); } } if (s1 !== peg$FAILED) { s2 = peg$parseconnectorsize(); if (s2 !== peg$FAILED) { s1 = [s1, s2]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parseconnectorsize(); if (s1 !== peg$FAILED) { if (peg$c71.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c72); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } return s0; } function peg$parsestartblock() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (peg$c73.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c74); } } if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { s1 = [s1, s2, s3]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseendblock() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (peg$c75.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c76); } } if (s2 !== peg$FAILED) { s1 = [s1, s2]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsepropertyset() { var s0; if (input.substr(peg$currPos, 13) === peg$c77) { s0 = peg$c77; peg$currPos += 13; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c78); } } return s0; } function peg$parsepackagedeclaration() { var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; if (input.substr(peg$currPos, 8) === peg$c79) { s1 = peg$c79; peg$currPos += 8; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c80); } } if (s1 !== peg$FAILED) { s2 = peg$parseobjectname(); if (s2 !== peg$FAILED) { s3 = peg$parsestartblock(); if (s3 !== peg$FAILED) { s4 = peg$parsenewline(); if (s4 !== peg$FAILED) { s5 = peg$parseumllines(); if (s5 !== peg$FAILED) { s6 = peg$parseendblock(); if (s6 !== peg$FAILED) { s1 = [s1, s2, s3, s4, s5, s6]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.substr(peg$currPos, 8) === peg$c79) { s1 = peg$c79; peg$currPos += 8; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c80); } } if (s1 !== peg$FAILED) { s2 = peg$parseobjectname(); if (s2 !== peg$FAILED) { s3 = peg$parsenewline(); if (s3 !== peg$FAILED) { s4 = peg$parseumllines(); if (s4 !== peg$FAILED) { if (input.substr(peg$currPos, 11) === peg$c81) { s5 = peg$c81; peg$currPos += 11; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c82); } } if (s5 !== peg$FAILED) { s1 = [s1, s2, s3, s4, s5]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } return s0; } function peg$parseabstractclassdeclaration() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11; s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 9) === peg$c83) { s2 = peg$c83; peg$currPos += 9; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c84); } } if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { if (input.substr(peg$currPos, 6) === peg$c85) { s4 = peg$c85; peg$currPos += 6; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c86); } } if (s4 === peg$FAILED) { s4 = null; } if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { s6 = peg$parseobjectname(); if (s6 !== peg$FAILED) { s7 = peg$parsenoise(); if (s7 !== peg$FAILED) { s8 = peg$parsestartblock(); if (s8 !== peg$FAILED) { s9 = peg$parseumllines(); if (s9 !== peg$FAILED) { s10 = peg$parseendblock(); if (s10 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c87(s6, s9); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 9) === peg$c83) { s2 = peg$c83; peg$currPos += 9; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c84); } } if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { if (input.substr(peg$currPos, 6) === peg$c85) { s4 = peg$c85; peg$currPos += 6; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c86); } } if (s4 === peg$FAILED) { s4 = null; } if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { s6 = peg$parseobjectname(); if (s6 !== peg$FAILED) { s7 = peg$parsenoise(); if (s7 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c88(s6); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 9) === peg$c83) { s2 = peg$c83; peg$currPos += 9; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c84); } } if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { if (input.substr(peg$currPos, 6) === peg$c85) { s4 = peg$c85; peg$currPos += 6; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c86); } } if (s4 === peg$FAILED) { s4 = null; } if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { s6 = peg$parseobjectname(); if (s6 !== peg$FAILED) { s7 = peg$parsenoise(); if (s7 !== peg$FAILED) { s8 = peg$parsenewline(); if (s8 !== peg$FAILED) { s9 = peg$parsenoise(); if (s9 !== peg$FAILED) { s10 = peg$parseumllines(); if (s10 !== peg$FAILED) { if (input.substr(peg$currPos, 9) === peg$c89) { s11 = peg$c89; peg$currPos += 9; } else { s11 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c90); } } if (s11 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c87(s6, s10); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } } return s0; } function peg$parsenoise() { var s0, s1; s0 = []; if (peg$c91.test(input.charAt(peg$currPos))) { s1 = input.charAt(peg$currPos); peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c92); } } while (s1 !== peg$FAILED) { s0.push(s1); if (peg$c91.test(input.charAt(peg$currPos))) { s1 = input.charAt(peg$currPos); peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c92); } } } return s0; } function peg$parsenewline() { var s0; if (peg$c93.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c94); } } if (s0 === peg$FAILED) { if (peg$c95.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c96); } } } return s0; } function peg$parseclassdeclaration() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11; s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 6) === peg$c85) { s2 = peg$c85; peg$currPos += 6; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c86); } } if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { s4 = peg$parseobjectname(); if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { s6 = peg$parsestartblock(); if (s6 !== peg$FAILED) { s7 = peg$parseumllines(); if (s7 !== peg$FAILED) { s8 = peg$parseendblock(); if (s8 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c97(s4, s7); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 6) === peg$c85) { s2 = peg$c85; peg$currPos += 6; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c86); } } if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { s4 = peg$parseobjectname(); if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c98) { s6 = peg$c98; peg$currPos += 2; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c99); } } if (s6 !== peg$FAILED) { s7 = peg$parsenoise(); if (s7 !== peg$FAILED) { s8 = []; if (peg$c100.test(input.charAt(peg$currPos))) { s9 = input.charAt(peg$currPos); peg$currPos++; } else { s9 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c101); } } if (s9 !== peg$FAILED) { while (s9 !== peg$FAILED) { s8.push(s9); if (peg$c100.test(input.charAt(peg$currPos))) { s9 = input.charAt(peg$currPos); peg$currPos++; } else { s9 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c101); } } } } else { s8 = peg$FAILED; } if (s8 !== peg$FAILED) { s9 = peg$parsenoise(); if (s9 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c102) { s10 = peg$c102; peg$currPos += 2; } else { s10 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c103); } } if (s10 !== peg$FAILED) { s11 = peg$parsenoise(); if (s11 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c104(s4); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 6) === peg$c85) { s2 = peg$c85; peg$currPos += 6; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c86); } } if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { s4 = peg$parseobjectname(); if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c104(s4); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 6) === peg$c85) { s2 = peg$c85; peg$currPos += 6; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c86); } } if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { s4 = peg$parseobjectname(); if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { s6 = peg$parsenewline(); if (s6 !== peg$FAILED) { s7 = peg$parsenoise(); if (s7 !== peg$FAILED) { s8 = peg$parseumllines(); if (s8 !== peg$FAILED) { if (input.substr(peg$currPos, 9) === peg$c89) { s9 = peg$c89; peg$currPos += 9; } else { s9 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c90); } } if (s9 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c97(s4, s8); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } } } return s0; } function peg$parseinterfacedeclaration() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11; s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 10) === peg$c105) { s2 = peg$c105; peg$currPos += 10; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c106); } } if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { s4 = peg$parseobjectname(); if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { s6 = peg$parsestartblock(); if (s6 !== peg$FAILED) { s7 = peg$parseumllines(); if (s7 !== peg$FAILED) { s8 = peg$parseendblock(); if (s8 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c107(s4, s7); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 10) === peg$c105) { s2 = peg$c105; peg$currPos += 10; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c106); } } if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { s4 = peg$parseobjectname(); if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c98) { s6 = peg$c98; peg$currPos += 2; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c99); } } if (s6 !== peg$FAILED) { s7 = peg$parsenoise(); if (s7 !== peg$FAILED) { s8 = []; if (peg$c100.test(input.charAt(peg$currPos))) { s9 = input.charAt(peg$currPos); peg$currPos++; } else { s9 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c101); } } if (s9 !== peg$FAILED) { while (s9 !== peg$FAILED) { s8.push(s9); if (peg$c100.test(input.charAt(peg$currPos))) { s9 = input.charAt(peg$currPos); peg$currPos++; } else { s9 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c101); } } } } else { s8 = peg$FAILED; } if (s8 !== peg$FAILED) { s9 = peg$parsenoise(); if (s9 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c102) { s10 = peg$c102; peg$currPos += 2; } else { s10 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c103); } } if (s10 !== peg$FAILED) { s11 = peg$parsenoise(); if (s11 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c108(s4); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 10) === peg$c105) { s2 = peg$c105; peg$currPos += 10; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c106); } } if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { s4 = peg$parseobjectname(); if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c108(s4); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 10) === peg$c105) { s2 = peg$c105; peg$currPos += 10; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c106); } } if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { s4 = peg$parseobjectname(); if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { s6 = peg$parsenewline(); if (s6 !== peg$FAILED) { s7 = peg$parsenoise(); if (s7 !== peg$FAILED) { s8 = peg$parseumllines(); if (s8 !== peg$FAILED) { if (input.substr(peg$currPos, 13) === peg$c109) { s9 = peg$c109; peg$currPos += 13; } else { s9 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c110); } } if (s9 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c111(s4, s8); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } } } return s0; } function peg$parsecolor() { var s0, s1, s2, s3; s0 = peg$currPos; if (peg$c112.test(input.charAt(peg$currPos))) { s1 = input.charAt(peg$currPos); peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c113); } } if (s1 !== peg$FAILED) { s2 = []; if (peg$c114.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c115); } } if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); if (peg$c114.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c115); } } } } else { s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s1 = [s1, s2]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsenamespacedeclaration() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10; s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 10) === peg$c116) { s2 = peg$c116; peg$currPos += 10; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c117); } } if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { s4 = peg$parseobjectname(); if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { s6 = peg$parsecolor(); if (s6 === peg$FAILED) { s6 = null; } if (s6 !== peg$FAILED) { s7 = peg$parsenoise(); if (s7 !== peg$FAILED) { s8 = peg$parsestartblock(); if (s8 !== peg$FAILED) { s9 = peg$parseumllines(); if (s9 !== peg$FAILED) { s10 = peg$parseendblock(); if (s10 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c118(s4, s9); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 10) === peg$c116) { s2 = peg$c116; peg$currPos += 10; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c117); } } if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { s4 = peg$parseobjectname(); if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { s6 = peg$parsenewline(); if (s6 !== peg$FAILED) { s7 = peg$parseumllines(); if (s7 !== peg$FAILED) { if (input.substr(peg$currPos, 13) === peg$c119) { s8 = peg$c119; peg$currPos += 13; } else { s8 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c120); } } if (s8 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c121(s4); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } return s0; } function peg$parsestaticmemberdeclaration() { var s0, s1, s2; s0 = peg$currPos; if (input.substr(peg$currPos, 7) === peg$c122) { s1 = peg$c122; peg$currPos += 7; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c123); } } if (s1 !== peg$FAILED) { s2 = peg$parsememberdeclaration(); if (s2 !== peg$FAILED) { s1 = [s1, s2]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsememberdeclaration() { var s0, s1; s0 = peg$currPos; s1 = peg$parsemethoddeclaration(); if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c8(s1); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsefielddeclaration(); if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c8(s1); } s0 = s1; } return s0; } function peg$parsefielddeclaration() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { s2 = peg$parseaccessortype(); if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { s4 = peg$parsereturntype(); if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { s6 = peg$parsemembername(); if (s6 !== peg$FAILED) { s7 = peg$parsenoise(); if (s7 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c124(s2, s4, s6); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { s2 = peg$parseaccessortype(); if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { s4 = peg$parsemembername(); if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { if (peg$c15.test(input.charAt(peg$currPos))) { s6 = input.charAt(peg$currPos); peg$currPos++; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c16); } } if (s6 !== peg$FAILED) { s7 = peg$parsenoise(); if (s7 !== peg$FAILED) { s8 = peg$parsereturntype(); if (s8 !== peg$FAILED) { s9 = peg$parsenoise(); if (s9 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c125(s2, s4, s8); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { s2 = peg$parseaccessortype(); if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { s4 = peg$parsemembername(); if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c126(s2, s4); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { s2 = peg$parsereturntype(); if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { s4 = peg$parsemembername(); if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c127(s2, s4); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { s2 = peg$parsemembername(); if (s2 !== peg$FAILED) { s3 = peg$parsenoise(); if (s3 !== peg$FAILED) { if (peg$c15.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c16); } } if (s4 !== peg$FAILED) { s5 = peg$parsenoise(); if (s5 !== peg$FAILED) { s6 = peg$parsereturntype(); if (s6 !== peg$FAILED) { s7 = peg$parsenoise(); if (s7 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c128(s2, s6); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } } } } return s0; } function peg$parsemethoddeclaration() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10; s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { s2 = peg$parsefielddeclaration(); if (s2 !== peg$FAILED) { if (peg$c129.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c130); } } if (s3 !== peg$FAILED) { s4 = peg$parsemethodparameters(); if (s4 !== peg$FAILED) { if (peg$c131.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c132); } } if (s5 !== peg$FAILED) { s6 = peg$parsenoise(); if (s6 !== peg$FAILED) { if (peg$c15.test(input.charAt(peg$currPos))) { s7 = input.charAt(peg$currPos); peg$currPos++; } else { s7 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c16); } } if (s7 !== peg$FAILED) { s8 = peg$parsenoise(); if (s8 !== peg$FAILED) { s9 = peg$parsereturntype(); if (s9 !== peg$FAILED) { s10 = peg$parsenoise(); if (s10 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c133(s2, s4, s9); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { s2 = peg$parsefielddeclaration(); if (s2 !== peg$FAILED) { if (peg$c129.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c130); } } if (s3 !== peg$FAILED) { s4 = peg$parsemethodparameters(); if (s4 !== peg$FAILED) { if (peg$c131.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c132); } } if (s5 !== peg$FAILED) { s6 = peg$parsenoise(); if (s6 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c134(s2, s4); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } return s0; } function peg$parsemethodparameters() { var s0, s1, s2; s0 = peg$currPos; s1 = []; s2 = peg$parsemethodparameter(); while (s2 !== peg$FAILED) { s1.push(s2); s2 = peg$parsemethodparameter(); } if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c135(s1); } s0 = s1; return s0; } function peg$parsemethodparameter() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsenoise(); if (s1 !== peg$FAILED) { s2 = peg$parsereturntype(); if (s2 !== peg$FAILED) { s3 = peg$currPos; if (peg$c136.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c137); } } if (s4 !== peg$FAILED) { s5 = peg$parsemembername(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } } else { peg$currPos = s3; s3 = peg$FAILED; } if (s3 === peg$FAILED) { s3 = null; } if (s3 !== peg$FAILED) { if (peg$c138.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c139); } } if (s4 === peg$FAILED) { s4 = null; } if (s4 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c140(s2, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsereturntype() { var s0, s1, s2; s0 = peg$currPos; s1 = []; if (peg$c141.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c142); } } if (s2 !== peg$FAILED) { while (s2 !== peg$FAILED) { s1.push(s2); if (peg$c141.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c142); } } } } else { s1 = peg$FAILED; } if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c143(s1); } s0 = s1; return s0; } function peg$parseobjectname() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$currPos; if (peg$c144.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c145); } } if (s2 !== peg$FAILED) { s3 = []; if (peg$c146.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c147); } } while (s4 !== peg$FAILED) { s3.push(s4); if (peg$c146.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c147); } } } if (s3 !== peg$FAILED) { s2 = [s2, s3]; s1 = s2; } else { peg$currPos = s1; s1 = peg$FAILED; } } else { peg$currPos = s1; s1 = peg$FAILED; } if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c148(s1); } s0 = s1; return s0; } function peg$parsemembername() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$currPos; if (peg$c144.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c145); } } if (s2 !== peg$FAILED) { s3 = []; if (peg$c149.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c150); } } while (s4 !== peg$FAILED) { s3.push(s4); if (peg$c149.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c150); } } } if (s3 !== peg$FAILED) { s2 = [s2, s3]; s1 = s2; } else { peg$currPos = s1; s1 = peg$FAILED; } } else { peg$currPos = s1; s1 = peg$FAILED; } if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c151(s1); } s0 = s1; return s0; } function peg$parseaccessortype() { var s0; s0 = peg$parsepublicaccessor(); if (s0 === peg$FAILED) { s0 = peg$parseprivateaccessor(); if (s0 === peg$FAILED) { s0 = peg$parseprotectedaccessor(); } } return s0; } function peg$parsepublicaccessor() { var s0; if (peg$c152.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c153); } } return s0; } function peg$parseprivateaccessor() { var s0; if (peg$c63.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c64); } } return s0; } function peg$parseprotectedaccessor() { var s0; if (peg$c112.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c113); } } return s0; } peg$result = peg$startRuleFunction(); if (peg$result !== peg$FAILED && peg$currPos === input.length) { return peg$result; } else { if (peg$result !== peg$FAILED && peg$currPos < input.length) { peg$fail({ type: "end", description: "end of input" }); } throw peg$buildException( null, peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos) ); } } return { SyntaxError: peg$SyntaxError, parse: peg$parse }; })(); ================================================ FILE: src/plantuml.pegjs ================================================ plantumlfile = items:((noise newline { return null }) / (noise "@startuml" noise newline filelines:umllines noise "@enduml" noise { var UMLBlock = require("./UMLBlock"); return new UMLBlock(filelines) }))* { for (var i = 0; i < items.length; i++) { if (items[i] === null) { items.splice(i, 1); i--; } } return items } umllines = lines:(umlline*) { for (var i = 0; i < lines.length; i++) { if (lines[i]===null) { lines.splice(i, 1); i--; } } return lines; } umlline = propertyset newline { return null } / titleset newline { return null } / noise newline { return null } / commentline { return null } / noteline { return null } / hideline newline { return null } / skinparams newline { return null } / declaration:packagedeclaration newline { return declaration } / declaration:namespacedeclaration newline { return declaration } / declaration:classdeclaration newline { return declaration } / declaration:interfacedeclaration newline { return declaration } / declaration:abstractclassdeclaration newline { return declaration } / declaration:memberdeclaration newline { return declaration } / declaration:connectordeclaration newline { return declaration } hideline = noise "hide empty members" noise skinparams = noise "skinparam" noise [^\r\n]+ connectordeclaration = noise leftObject:objectname noise connectordescription? noise connector:connectortype noise connectordescription? noise rightObject:objectname noise ([:] [^\r\n]+)? { var Connection = require("./Connection"); return new Connection(leftObject, connector, rightObject) } connectordescription = noise ["]([\\]["]/[^"])*["] noise titleset = noise "title " noise [^\r\n]+ noise commentline = noise "'" [^\r\n]+ noise / noise ".." [^\r\n\.]+ ".." noise / noise "--" [^\r\n\-]+ "--" noise / noise "__" [^\r\n\_]+ "__" noise noteline = noise "note " noise [^\r\n]+ noise connectortype = item:extends { return item } / concatenates { var Composition = require("./Composition"); return new Composition() } / aggregates { var Aggregation = require("./Aggregation"); return new Aggregation() } / connectorsize { return null } extends = "<|" connectorsize { var Extension = require("./Extension"); return new Extension(true) } / connectorsize "|>" { var Extension = require("./Extension"); return new Extension(false) } connectorsize = ".." / "-up-" / "-down-" / "-left-" / "-right-" / "---" / "--" / [.] / [-] concatenates = "*" connectorsize / connectorsize [*] aggregates = "o" connectorsize / connectorsize [o] startblock = noise [{] noise endblock = noise [}] propertyset = "setpropname.*" packagedeclaration = "package " objectname startblock newline umllines endblock / "package " objectname newline umllines "end package" abstractclassdeclaration = noise "abstract " noise "class "? noise classname:objectname noise startblock lines:umllines endblock { var AbstractClass = require("./AbstractClass"); return new AbstractClass(classname, lines) } / noise "abstract " noise "class "? noise classname:objectname noise { var AbstractClass = require("./AbstractClass"); return new AbstractClass(classname) } / noise "abstract " noise "class "? noise classname:objectname noise newline noise lines:umllines "end class" { var AbstractClass = require("./AbstractClass"); return new AbstractClass(classname, lines) } noise = [ \t]* newline = [\r\n] / [\n] classdeclaration = noise "class " noise classname:objectname noise startblock lines:umllines endblock { var Class = require("./Class"); return new Class(classname, lines) } / noise "class " noise classname:objectname noise "<<" noise [^>]+ noise ">>" noise { var Class = require("./Class"); return new Class(classname) } / noise "class " noise classname:objectname noise { var Class = require("./Class"); return new Class(classname) } / noise "class " noise classname:objectname noise newline noise lines:umllines "end class" { var Class = require("./Class"); return new Class(classname, lines) } interfacedeclaration = noise "interface " noise interfacename:objectname noise startblock lines:umllines endblock { var Interface = require("./Interface"); return new Interface(interfacename, lines) } / noise "interface " noise interfacename:objectname noise "<<" noise [^>]+ noise ">>" noise { var Interface = require("./Interface"); return new Interface(interfacename) } / noise "interface " noise interfacename:objectname noise { var Interface = require("./Interface"); return new Interface(interfacename) } / noise "interface " noise interfacename:objectname noise newline noise lines:umllines "end interface" { var Interface = require("./Interface"); return new Interface(interfacename, lines) } color = [#][0-9a-fA-F]+ namespacedeclaration = noise "namespace " noise namespacename:objectname noise color? noise startblock lines:umllines endblock { var Namespace = require("./Namespace"); return new Namespace(namespacename, lines) } / noise "namespace " noise namespacename:objectname noise newline umllines "end namespace" { var Namespace = require("./Namespace"); return new Namespace(namespacename) } staticmemberdeclaration = "static " memberdeclaration memberdeclaration = declaration:methoddeclaration { return declaration } / declaration:fielddeclaration { return declaration } fielddeclaration = noise accessortype:accessortype noise returntype:returntype noise membername:membername noise { var Field = require("./Field"); return new Field(accessortype, returntype, membername) } / noise accessortype:accessortype noise membername:membername noise [:] noise returntype:returntype noise { var Field = require("./Field"); return new Field(accessortype, returntype, membername) } / noise accessortype:accessortype noise membername:membername noise { var Field = require("./Field"); return new Field(accessortype, "void", membername) } / noise returntype:returntype noise membername:membername noise { var Field = require("./Field"); return new Field("+", returntype, membername) } / noise membername:membername noise [:] noise returntype:returntype noise { var Field = require("./Field"); return new Field("+", returntype, membername) } methoddeclaration = noise field:fielddeclaration [(] parameters:methodparameters [)] noise [:] noise returntype:returntype noise { var Method = require("./Method"); return new Method(field.getAccessType(), returntype, field.getName(), parameters); } / noise field:fielddeclaration [(] parameters:methodparameters [)] noise { var Method = require("./Method"); return new Method(field.getAccessType(), field.getReturnType(), field.getName(), parameters); } methodparameters = items:methodparameter* { return items; } methodparameter = noise item:returntype membername:([ ] membername)? [,]? { var Parameter = require("./Parameter"); return new Parameter(item, membername ? membername[1] : null); } returntype = items:[^ ,\n\r\t(){}]+ { return items.join("") } objectname = objectname:([A-Za-z_][A-Za-z0-9.]*) { return [objectname[0], objectname[1].join("")].join("") } membername = items:([A-Za-z_][A-Za-z0-9_]*) { return [items[0], items[1].join("")].join("") } accessortype = publicaccessor / privateaccessor / protectedaccessor publicaccessor = [+] privateaccessor = [-] protectedaccessor = [#] ================================================ FILE: templates/coffeescript.hbs ================================================ {{#if_ne getKeyword "interface"}}class {{getFullName}}{{#if getExtends}} extends {{#with getExtends}}{{getFullName}}{{/with}}{{/if}} {{#each getFields}} {{this.getName}}: undefined {{/each}} {{#each getMethods}} {{this.getName}}: {{#if this.getParameters}}({{#each this.getParameters}}{{#if @first}}{{else}},{{/if}}{{#if this.getName}}{{this.getName}}{{else}}param{{@index}}{{/if}}{{/each}}){{/if}} -> {{/each}}{{/if_ne}} ================================================ FILE: templates/csharp.hbs ================================================ {{getKeyword}} {{getFullName}}{{#if getExtends}} : {{#with getExtends}}{{getFullName}}{{/with}}{{/if}} { {{#each getFields}} private {{this.getReturnType}} {{this.getName}}; {{/each}} {{#each getMethods}} public {{this.getReturnType}} {{this.getName}}{{#if this.getParameters}}({{#each this.getParameters}}{{#if @first}}{{else}},{{/if}}{{this.getReturnType}} {{#if this.getName}}{{this.getName}}{{else}}param{{@index}}{{/if}}{{/each}}){{else}}(){{/if}} { {{#if this.needsReturnStatement}} return null; {{/if}} } {{/each}} } ================================================ FILE: templates/ecmascript5.hbs ================================================ {{#if_ne getKeyword "interface"}} {{#if getExtends}} function {{getFullName}}() { {{#with getExtends}}{{getFullName}}{{/with}}.prototype.constructor.apply(this, arguments); } {{getFullName}}.prototype = Object.create({{#with getExtends}}{{getFullName}}{{/with}}.prototype); {{getFullName}}.prototype.constructor = {{getFullName}}; {{else}} function {{getFullName}}() {} {{/if}} {{#each getFields}} {{#call ../this ../getFullName}}{{/call}}.prototype.{{getName}} = undefined; {{/each}} {{#each getMethods}} {{#call ../this ../getFullName}}{{/call}}.prototype.{{getName}} = function ({{#if getParameters}}{{#each getParameters}}{{#if @first}}{{else}},{{/if}}{{#if getName}}{{getName}}{{else}}param{{@index}}{{/if}}{{/each}}{{/if}}) {}; {{/each}} {{/if_ne}} ================================================ FILE: templates/ecmascript6.hbs ================================================ {{#if_ne getKeyword "interface"}}class {{getFullName}}{{#if getExtends}} extends {{#with getExtends}}{{getFullName}}{{/with}}{{/if}} { {{#if getExtends}} {{#if hasFields}} constructor: function () { super().apply(this, arguments); {{#each getFields}} this.{{getName}} = undefined; {{/each}} }{{#if hasMethods}},{{/if}} {{/if}} {{else}} {{#if hasFields}} constructor: function () { {{#each getFields}} this.{{getName}} = undefined; {{/each}} }{{#if hasMethods}},{{/if}} {{/if}} {{/if}} {{#each getMethods}} {{getName}}: function ({{#if getParameters}}{{#each getParameters}}{{#if @first}}{{else}},{{/if}}{{#if getName}}{{getName}}{{else}}param{{@index}}{{/if}}{{/each}}{{/if}}) {}{{#if @last}}{{else}},{{/if}} {{/each}} }{{/if_ne}} ================================================ FILE: templates/index.js ================================================ // DO NOT EDIT THIS FILE. GENERATED WITH scripts/build_templates.js exports.coffeescript = `{{#if_ne getKeyword "interface"}}class {{getFullName}}{{#if getExtends}} extends {{#with getExtends}}{{getFullName}}{{/with}}{{/if}} {{#each getFields}} {{this.getName}}: undefined {{/each}} {{#each getMethods}} {{this.getName}}: {{#if this.getParameters}}({{#each this.getParameters}}{{#if @first}}{{else}},{{/if}}{{#if this.getName}}{{this.getName}}{{else}}param{{@index}}{{/if}}{{/each}}){{/if}} -> {{/each}}{{/if_ne}} `; exports.csharp = `{{getKeyword}} {{getFullName}}{{#if getExtends}} : {{#with getExtends}}{{getFullName}}{{/with}}{{/if}} { {{#each getFields}} private {{this.getReturnType}} {{this.getName}}; {{/each}} {{#each getMethods}} public {{this.getReturnType}} {{this.getName}}{{#if this.getParameters}}({{#each this.getParameters}}{{#if @first}}{{else}},{{/if}}{{this.getReturnType}} {{#if this.getName}}{{this.getName}}{{else}}param{{@index}}{{/if}}{{/each}}){{else}}(){{/if}} { {{#if this.needsReturnStatement}} return null; {{/if}} } {{/each}} } `; exports.ecmascript5 = `{{#if_ne getKeyword "interface"}} {{#if getExtends}} function {{getFullName}}() { {{#with getExtends}}{{getFullName}}{{/with}}.prototype.constructor.apply(this, arguments); } {{getFullName}}.prototype = Object.create({{#with getExtends}}{{getFullName}}{{/with}}.prototype); {{getFullName}}.prototype.constructor = {{getFullName}}; {{else}} function {{getFullName}}() {} {{/if}} {{#each getFields}} {{#call ../this ../getFullName}}{{/call}}.prototype.{{getName}} = undefined; {{/each}} {{#each getMethods}} {{#call ../this ../getFullName}}{{/call}}.prototype.{{getName}} = function ({{#if getParameters}}{{#each getParameters}}{{#if @first}}{{else}},{{/if}}{{#if getName}}{{getName}}{{else}}param{{@index}}{{/if}}{{/each}}{{/if}}) {}; {{/each}} {{/if_ne}} `; exports.ecmascript6 = `{{#if_ne getKeyword "interface"}}class {{getFullName}}{{#if getExtends}} extends {{#with getExtends}}{{getFullName}}{{/with}}{{/if}} { {{#if getExtends}} {{#if hasFields}} constructor: function () { super().apply(this, arguments); {{#each getFields}} this.{{getName}} = undefined; {{/each}} }{{#if hasMethods}},{{/if}} {{/if}} {{else}} {{#if hasFields}} constructor: function () { {{#each getFields}} this.{{getName}} = undefined; {{/each}} }{{#if hasMethods}},{{/if}} {{/if}} {{/if}} {{#each getMethods}} {{getName}}: function ({{#if getParameters}}{{#each getParameters}}{{#if @first}}{{else}},{{/if}}{{#if getName}}{{getName}}{{else}}param{{@index}}{{/if}}{{/each}}{{/if}}) {}{{#if @last}}{{else}},{{/if}} {{/each}} }{{/if_ne}} `; exports.java = `{{getKeyword}} {{getFullName}}{{#if getExtends}} extends {{#with getExtends}}{{getFullName}}{{/with}}{{/if}} { {{#each getFields}} private {{this.getReturnType}} {{this.getName}}; {{/each}} {{#each getMethods}} public {{this.getReturnType}} {{this.getName}}{{#if this.getParameters}}({{#each this.getParameters}}{{#if @first}}{{else}},{{/if}}{{this.getReturnType}} {{#if this.getName}}{{this.getName}}{{else}}param{{@index}}{{/if}}{{/each}}){{else}}(){{/if}} { {{#if this.needsReturnStatement}} return null; {{/if}} } {{/each}} } `; exports.php = ` `; exports.python = `class {{getFullName}}{{#if getExtends}}({{#with getExtends}}{{getFullName}}{{/with}}){{/if}}: def __init__(self): {{#each getFields}} self.{{this.getName}} = None; {{/each}} pass; {{#each getMethods}} def {{this.getName}}{{#if this.getParameters}}({{#each this.getParameters}}{{#if @first}}{{else}},{{/if}}{{#if this.getName}}{{this.getName}}{{else}}param{{@index}}{{/if}}{{/each}}){{else}}(){{/if}}: pass; {{/each}} `; exports.ruby = `{{#if_ne getKeyword "interface"}}class {{getFullName}}{{#if getExtends}} < {{#with getExtends}}{{getFullName}}{{/with}}{{/if}} {{#each getFields}} @{{this.getName}} {{/each}} {{#each getMethods}} def {{this.getName}}{{#if this.getParameters}} ({{#each this.getParameters}}{{#if @first}}{{else}},{{/if}}{{#if this.getName}}{{this.getName}}{{else}}param{{@index}}{{/if}}{{/each}}){{/if}} return end {{/each}} end{{/if_ne}} `; exports.typescript = `{{getKeyword}} {{getFullName}}{{#if getExtends}} extends {{#with getExtends}}{{getFullName}}{{/with}}{{/if}} { {{#each getFields}} {{#if this.isPublic}}public{{else if this.isPrivate}}private{{else if this.isProtected}}protected{{/if}} {{this.getName}} : {{this.getReturnType}}; {{/each}} {{#each getMethods}} {{#if this.isPublic}}public{{else if this.isPrivate}}private{{else if this.isProtected}}protected{{/if}} {{this.getName}}{{#if this.getParameters}}({{#each this.getParameters}}{{#if @first}}{{else}},{{/if}}{{#if this.getName}}{{this.getName}}{{else}}param{{@index}}{{/if}}{{/each}}){{else}}(){{/if}} { return; } {{/each}} } `; exports.swift = `class {{getFullName}}{{#if getExtends}} : {{#with getExtends}}{{getFullName}}{{/with}}{{/if}} { {{#each getFields}} var {{this.getName}}: {{this.getReturnType}}? = nil; {{/each}} {{#each getMethods}} func {{this.getName}}{{#if this.getParameters}}({{#each this.getParameters}}{{#if @first}}{{else}},{{/if}}{{#if this.getName}}{{this.getName}}:{{this.getReturnType}}{{else}}param{{@index}}: Any{{/if}}{{/each}}){{else}}(){{/if}}{{#if_ne2 this "void"}} -> {{this.getReturnType}}{{/if_ne2}}{ {{#if_ne2 this "void"}} return {{this.getReturnType}}(){{/if_ne2}} } {{/each}} } `; exports.kotlin = `{{getKeyword}} {{getFullName}}{{#if getExtends}} : {{#with getExtends}}{{getFullName}}{{/with}}(){{/if}} { {{#each getFields}} var {{this.getReturnType}} {{this.getName}}: {{this.getReturnType}} {{/each}} {{#each getMethods}} public fun {{this.getName}}{{#if this.getParameters}}({{#each this.getParameters}}{{#if @first}}{{else}},{{/if}}{{this.getReturnType}} {{#if this.getName}}{{this.getName}}{{else}}param{{@index}}{{/if}}{{/each}}){{else}}(): {{this.getReturnType}}{{/if}} { {{#if this.needsReturnStatement}} return null {{/if}} } {{/each}} } `; ================================================ FILE: templates/java.hbs ================================================ {{getKeyword}} {{getFullName}}{{#if getExtends}} extends {{#with getExtends}}{{getFullName}}{{/with}}{{/if}} { {{#each getFields}} private {{this.getReturnType}} {{this.getName}}; {{/each}} {{#each getMethods}} public {{this.getReturnType}} {{this.getName}}{{#if this.getParameters}}({{#each this.getParameters}}{{#if @first}}{{else}},{{/if}}{{this.getReturnType}} {{#if this.getName}}{{this.getName}}{{else}}param{{@index}}{{/if}}{{/each}}){{else}}(){{/if}} { {{#if this.needsReturnStatement}} return null; {{/if}} } {{/each}} } ================================================ FILE: templates/kotlin.hbs ================================================ {{getKeyword}} {{getFullName}}{{#if getExtends}} : {{#with getExtends}}{{getFullName}}{{/with}}(){{/if}} { {{#each getFields}} var {{this.getReturnType}} {{this.getName}}: {{this.getReturnType}} {{/each}} {{#each getMethods}} public fun {{this.getName}}{{#if this.getParameters}}({{#each this.getParameters}}{{#if @first}}{{else}},{{/if}}{{this.getReturnType}} {{#if this.getName}}{{this.getName}}{{else}}param{{@index}}{{/if}}{{/each}}){{else}}(): {{this.getReturnType}}{{/if}} { {{#if this.needsReturnStatement}} return null {{/if}} } {{/each}} } ================================================ FILE: templates/php.hbs ================================================ ================================================ FILE: templates/python.hbs ================================================ class {{getFullName}}{{#if getExtends}}({{#with getExtends}}{{getFullName}}{{/with}}){{/if}}: def __init__(self): {{#each getFields}} self.{{this.getName}} = None; {{/each}} pass; {{#each getMethods}} def {{this.getName}}{{#if this.getParameters}}({{#each this.getParameters}}{{#if @first}}{{else}},{{/if}}{{#if this.getName}}{{this.getName}}{{else}}param{{@index}}{{/if}}{{/each}}){{else}}(){{/if}}: pass; {{/each}} ================================================ FILE: templates/ruby.hbs ================================================ {{#if_ne getKeyword "interface"}}class {{getFullName}}{{#if getExtends}} < {{#with getExtends}}{{getFullName}}{{/with}}{{/if}} {{#each getFields}} @{{this.getName}} {{/each}} {{#each getMethods}} def {{this.getName}}{{#if this.getParameters}} ({{#each this.getParameters}}{{#if @first}}{{else}},{{/if}}{{#if this.getName}}{{this.getName}}{{else}}param{{@index}}{{/if}}{{/each}}){{/if}} return end {{/each}} end{{/if_ne}} ================================================ FILE: templates/swift.hbs ================================================ class {{getFullName}}{{#if getExtends}} : {{#with getExtends}}{{getFullName}}{{/with}}{{/if}} { {{#each getFields}} var {{this.getName}}: {{this.getReturnType}}? = nil; {{/each}} {{#each getMethods}} func {{this.getName}}{{#if this.getParameters}}({{#each this.getParameters}}{{#if @first}}{{else}},{{/if}}{{#if this.getName}}{{this.getName}}:{{this.getReturnType}}{{else}}param{{@index}}: Any{{/if}}{{/each}}){{else}}(){{/if}}{{#if_ne2 this "void"}} -> {{this.getReturnType}}{{/if_ne2}}{ {{#if_ne2 this "void"}} return {{this.getReturnType}}(){{/if_ne2}} } {{/each}} } ================================================ FILE: templates/typescript.hbs ================================================ {{getKeyword}} {{getFullName}}{{#if getExtends}} extends {{#with getExtends}}{{getFullName}}{{/with}}{{/if}} { {{#each getFields}} {{#if this.isPublic}}public{{else if this.isPrivate}}private{{else if this.isProtected}}protected{{/if}} {{this.getName}} : {{this.getReturnType}}; {{/each}} {{#each getMethods}} {{#if this.isPublic}}public{{else if this.isPrivate}}private{{else if this.isProtected}}protected{{/if}} {{this.getName}}{{#if this.getParameters}}({{#each this.getParameters}}{{#if @first}}{{else}},{{/if}}{{#if this.getName}}{{this.getName}}{{else}}param{{@index}}{{/if}}{{/each}}){{else}}(){{/if}} { return; } {{/each}} } ================================================ FILE: tests/car.coffee ================================================ class Car model: undefined make: undefined year: undefined setModel: (model) -> setMake: (make) -> setYear: (param0) -> getModel: -> getMake: -> getYear: -> getDescription: -> class NamesInThings field: undefined field1: undefined _some_private: undefined field_2: undefined member_d: undefined member: -> member2: -> member3: -> member_s: -> class Toyota extends Car class Honda extends Car class Ford extends Car class Hyundai extends Car ================================================ FILE: tests/car.cs ================================================ abstract class Car { private String model; private String make; private Number year; public void setModel(String model) { } public void setMake(String make) { } public void setYear(Number param0) { } public String getModel() { return null; } public String getMake() { return null; } public Number getYear() { return null; } public String getDescription() { return null; } } interface Driver { private String name; } class NamesInThings { private String field; private String1 field1; private String _some_private; private String_2 field_2; private String member_d; public void member() { } public String1 member2() { return null; } public void member3() { } public String2 member_s() { return null; } } class Toyota : Car { } class Honda : Car { } class Ford : Car { } class Hyundai : Car { } ================================================ FILE: tests/car.java ================================================ abstract class Car { private String model; private String make; private Number year; public void setModel(String model) { } public void setMake(String make) { } public void setYear(Number param0) { } public String getModel() { return null; } public String getMake() { return null; } public Number getYear() { return null; } public String getDescription() { return null; } } interface Driver { private String name; } class NamesInThings { private String field; private String1 field1; private String _some_private; private String_2 field_2; private String member_d; public void member() { } public String1 member2() { return null; } public void member3() { } public String2 member_s() { return null; } } class Toyota extends Car { } class Honda extends Car { } class Ford extends Car { } class Hyundai extends Car { } ================================================ FILE: tests/car.js ================================================ function Car() {} Car.prototype.model = undefined; Car.prototype.make = undefined; Car.prototype.year = undefined; Car.prototype.setModel = function (model) {}; Car.prototype.setMake = function (make) {}; Car.prototype.setYear = function (param0) {}; Car.prototype.getModel = function () {}; Car.prototype.getMake = function () {}; Car.prototype.getYear = function () {}; Car.prototype.getDescription = function () {}; function NamesInThings() {} NamesInThings.prototype.field = undefined; NamesInThings.prototype.field1 = undefined; NamesInThings.prototype._some_private = undefined; NamesInThings.prototype.field_2 = undefined; NamesInThings.prototype.member_d = undefined; NamesInThings.prototype.member = function () {}; NamesInThings.prototype.member2 = function () {}; NamesInThings.prototype.member3 = function () {}; NamesInThings.prototype.member_s = function () {}; function Toyota() { Car.prototype.constructor.apply(this, arguments); } Toyota.prototype = Object.create(Car.prototype); Toyota.prototype.constructor = Toyota; function Honda() { Car.prototype.constructor.apply(this, arguments); } Honda.prototype = Object.create(Car.prototype); Honda.prototype.constructor = Honda; function Ford() { Car.prototype.constructor.apply(this, arguments); } Ford.prototype = Object.create(Car.prototype); Ford.prototype.constructor = Ford; function Hyundai() { Car.prototype.constructor.apply(this, arguments); } Hyundai.prototype = Object.create(Car.prototype); Hyundai.prototype.constructor = Hyundai; ================================================ FILE: tests/car.js6 ================================================ class Car { constructor: function () { this.model = undefined; this.make = undefined; this.year = undefined; }, setModel: function (model) {}, setMake: function (make) {}, setYear: function (param0) {}, getModel: function () {}, getMake: function () {}, getYear: function () {}, getDescription: function () {} } class NamesInThings { constructor: function () { this.field = undefined; this.field1 = undefined; this._some_private = undefined; this.field_2 = undefined; this.member_d = undefined; }, member: function () {}, member2: function () {}, member3: function () {}, member_s: function () {} } class Toyota extends Car { } class Honda extends Car { } class Ford extends Car { } class Hyundai extends Car { } ================================================ FILE: tests/car.kt ================================================ abstract class Car { var String model: String var String make: String var Number year: Number public fun setModel(String model) { } public fun setMake(String make) { } public fun setYear(Number param0) { } public fun getModel(): String { return null } public fun getMake(): String { return null } public fun getYear(): Number { return null } public fun getDescription(): String { return null } } interface Driver { var String name: String } class NamesInThings { var String field: String var String1 field1: String1 var String _some_private: String var String_2 field_2: String_2 var String member_d: String public fun member(): void { } public fun member2(): String1 { return null } public fun member3(): void { } public fun member_s(): String2 { return null } } class Toyota : Car() { } class Honda : Car() { } class Ford : Car() { } class Hyundai : Car() { } ================================================ FILE: tests/car.pegjs ================================================ @startuml hide empty members ' This is a comment line abstract Car { + void setModel(String model) + void setMake(String make) + void setYear(Number) + String getModel() + String getMake() + Number getYear() + getDescription() : String # String model - String make - Number year } interface Driver { + String name } class NamesInThings { + String field + String1 field1 - String _some_private - String_2 field_2 + void member() - String1 member2() # void member3() - String2 member_s() - member_d : String } class Toyota class Honda class Ford class Hyundai Toyota -left-|> Car Honda -right-|> Car Ford -up-|> Car Hyundai -down-|> Car @enduml ================================================ FILE: tests/car.php ================================================ ================================================ FILE: tests/car.py ================================================ class Car: def __init__(self): self.model = None; self.make = None; self.year = None; pass; def setModel(model): pass; def setMake(make): pass; def setYear(param0): pass; def getModel(): pass; def getMake(): pass; def getYear(): pass; def getDescription(): pass; class Driver: def __init__(self): self.name = None; pass; class NamesInThings: def __init__(self): self.field = None; self.field1 = None; self._some_private = None; self.field_2 = None; self.member_d = None; pass; def member(): pass; def member2(): pass; def member3(): pass; def member_s(): pass; class Toyota(Car): def __init__(self): pass; class Honda(Car): def __init__(self): pass; class Ford(Car): def __init__(self): pass; class Hyundai(Car): def __init__(self): pass; ================================================ FILE: tests/car.rb ================================================ class Car @model @make @year def setModel (model) return end def setMake (make) return end def setYear (param0) return end def getModel return end def getMake return end def getYear return end def getDescription return end end class NamesInThings @field @field1 @_some_private @field_2 @member_d def member return end def member2 return end def member3 return end def member_s return end end class Toyota < Car end class Honda < Car end class Ford < Car end class Hyundai < Car end ================================================ FILE: tests/car.swift ================================================ class Car { var model: String? = nil; var make: String? = nil; var year: Number? = nil; func setModel(model:String){ } func setMake(make:String){ } func setYear(param0: Any){ } func getModel() -> String{ return String() } func getMake() -> String{ return String() } func getYear() -> Number{ return Number() } func getDescription() -> String{ return String() } } class Driver { var name: String? = nil; } class NamesInThings { var field: String? = nil; var field1: String1? = nil; var _some_private: String? = nil; var field_2: String_2? = nil; var member_d: String? = nil; func member(){ } func member2() -> String1{ return String1() } func member3(){ } func member_s() -> String2{ return String2() } } class Toyota : Car { } class Honda : Car { } class Ford : Car { } class Hyundai : Car { } ================================================ FILE: tests/car.ts ================================================ abstract class Car { protected model : String; private make : String; private year : Number; public setModel(model) { return; } public setMake(make) { return; } public setYear(param0) { return; } public getModel() { return; } public getMake() { return; } public getYear() { return; } public getDescription() { return; } } interface Driver { public name : String; } class NamesInThings { public field : String; public field1 : String1; private _some_private : String; private field_2 : String_2; private member_d : String; public member() { return; } private member2() { return; } protected member3() { return; } private member_s() { return; } } class Toyota extends Car { } class Honda extends Car { } class Ford extends Car { } class Hyundai extends Car { } ================================================ FILE: tests/comment-file-simple.java ================================================ class A extends B { } class B { } ================================================ FILE: tests/comment-file-simple.pegjs ================================================ @startuml ' this is a comment class A class B A --|> B @enduml ================================================ FILE: tests/comments-dots.java ================================================ class User { private int age; private String password; public void getName() { } public void getAddress() { } public void setName() { } } ================================================ FILE: tests/comments-dots.pegjs ================================================ @startuml class User { .. Simple Getter .. + getName() + getAddress() .. Some setter .. + setName() __ private data __ int age -- encrypted -- String password } @enduml ================================================ FILE: tests/integration.js ================================================ var plantcode = require("../src/plantcode"); var exec = require('child_process').exec; var AbstractClass = require('../src/AbstractClass'); var Method = require("../src/Method"); var inputs = [{ language: "java", input: "tests/notes-file.pegjs", output: "tests/notes-file.java" }, { language: "java", input: "tests/comment-file-simple.pegjs", output: "tests/comment-file-simple.java" }, { language: "java", input: "tests/comments-dots.pegjs", output: "tests/comments-dots.java" }, { language: "csharp", input: "tests/car.pegjs", output: "tests/car.cs" }, { language: "java", input: "tests/car.pegjs", output: "tests/car.java" }, { language: "coffeescript", input: "tests/car.pegjs", output: "tests/car.coffee" }, { language: "typescript", input: "tests/car.pegjs", output: "tests/car.ts" }, { language: "ruby", input: "tests/car.pegjs", output: "tests/car.rb" }, { language: "php", input: "tests/car.pegjs", output: "tests/car.php" }, { language: "ecmascript5", input: "tests/car.pegjs", output: "tests/car.js" }, { language: "ecmascript6", input: "tests/car.pegjs", output: "tests/car.js6" }, { language: "swift", input: "tests/car.pegjs", output: "tests/car.swift" }, { language: "python", input: "tests/car.pegjs", output: "tests/car.py" }, { language: "kotlin", input: "tests/car.pegjs", output: "tests/car.kt" }]; for(var i = 0; i < inputs.length; i++) { plantcode.convertFile(inputs[i]); } for(var i = 0; i < inputs.length; i++) { exec('node plantcode -o ' + inputs[i].output + ' -l ' + inputs[i].language + ' ' + inputs[i].input, function(error, stdout, stderr) { if (error || stderr) { console.error(stderr); process.exit(0); } } ); } const abstractClass = new AbstractClass("FooBar", []); console.assert(abstractClass.getKeyword() === "abstract class"); console.assert(abstractClass.getName() === "FooBar"); console.assert(abstractClass.isAbstract() === true); const method = new Method("public", "string", "foobar", []); console.assert(method.getReturnType() === "string"); console.assert(method.getParameters().length === 0); console.assert(method.needsReturnStatement() === true); ================================================ FILE: tests/notes-file.java ================================================ class Object { } class Foo { } ================================================ FILE: tests/notes-file.pegjs ================================================ @startuml class Object << general >> Object <|--- ArrayList note top of Object : In java, every class\nextends this one. note "This is a floating note" as N1 note "This note is connected\nto several objects." as N2 Object .. N2 N2 .. ArrayList class Foo note left: On last defined class @enduml