Skip to content
Snippets Groups Projects
Commit 394d7e5d authored by René Schöne's avatar René Schöne
Browse files

One step forward (build still fails)

parent b64ab782
Branches
No related tags found
No related merge requests found
Showing
with 406 additions and 20 deletions
// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`.
export const environment = {
production: false
};
ragdoc-view/src/favicon.ico

1.12 KiB

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>JastAdd API Docs</title>
<base href="/">
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root>Loading...</app-root>
</body>
</html>
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule);
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
*
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
// import 'core-js/es6/symbol';
// import 'core-js/es6/object';
// import 'core-js/es6/function';
// import 'core-js/es6/parse-int';
// import 'core-js/es6/parse-float';
// import 'core-js/es6/number';
// import 'core-js/es6/math';
// import 'core-js/es6/string';
// import 'core-js/es6/date';
// import 'core-js/es6/array';
// import 'core-js/es6/regexp';
// import 'core-js/es6/map';
// import 'core-js/es6/set';
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.
/** IE10 and IE11 requires the following to support `@angular/animation`. */
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/** Evergreen browsers require these. **/
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
/** ALL Firefox browsers require the following to support `@angular/animation`. **/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/***************************************************************************************************
* Zone JS is required by Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/
/**
* Date, currency, decimal and percent pipes.
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
*/
// import 'intl'; // Run `npm install --save intl`.
/* You can add global styles to this file, and also import other style files */
a:hover {
background: #ff4;
}
::selection {
background: #ff4;
}
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/long-stack-trace-zone';
import 'zone.js/dist/proxy.js';
import 'zone.js/dist/sync-test';
import 'zone.js/dist/jasmine-patch';
import 'zone.js/dist/async-test';
import 'zone.js/dist/fake-async-test';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
declare var __karma__: any;
declare var require: any;
// Prevent Karma from running prematurely.
__karma__.loaded = function () {};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);
// Finally, start Karma to run the tests.
__karma__.start();
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "es2015",
"baseUrl": "",
"types": []
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"module": "commonjs",
"target": "es5",
"baseUrl": "",
"types": [
"jasmine",
"node"
]
},
"files": [
"test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}
/* SystemJS module definition */
declare var module: NodeModule;
interface NodeModule {
id: string;
}
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"baseUrl": "src",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2016",
"dom"
]
}
}
{
"rulesDirectory": [
"node_modules/codelyzer"
],
"rules": {
"callable-types": true,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
"eofline": true,
"forin": true,
"import-blacklist": [true, "rxjs"],
"import-spacing": true,
"indent": [
true,
"spaces"
],
"interface-over-type-literal": true,
"label-position": true,
"max-line-length": [
true,
140
],
"member-access": false,
"member-ordering": [
true,
"static-before-instance",
"variables-before-functions"
],
"no-arg": true,
"no-bitwise": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-debugger": true,
"no-duplicate-variable": true,
"no-empty": false,
"no-empty-interface": true,
"no-eval": true,
"no-inferrable-types": [true, "ignore-params"],
"no-shadowed-variable": true,
"no-string-literal": false,
"no-string-throw": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"object-literal-sort-keys": false,
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"prefer-const": true,
"quotemark": [
true,
"single"
],
"radix": true,
"semicolon": [
"always"
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"typeof-compare": true,
"unified-signatures": true,
"variable-name": false,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
],
"directive-selector": [true, "attribute", "app", "camelCase"],
"component-selector": [true, "element", "app", "kebab-case"],
"use-input-property-decorator": true,
"use-output-property-decorator": true,
"use-host-property-decorator": true,
"no-input-rename": true,
"no-output-rename": true,
"use-life-cycle-interface": true,
"use-pipe-transform-interface": true,
"component-class-suffix": true,
"directive-class-suffix": true,
"no-access-missing-member": true,
"templates-use-public": true,
"invoke-injectable": true
}
}
......@@ -129,7 +129,7 @@ task preprocess(type: JavaExec) {
args = [
"../tools/relast.jar",
"src/main/jastadd/CFG.ast",
"src/main/jastadd/CFG.relast",
"src/main/jastadd/ClassPathFilter.ast",
"../extendj/java8/grammar/ConstructorReference.ast",
"../extendj/java8/grammar/IntersectionCasts.ast",
......@@ -163,7 +163,7 @@ task preprocess(type: JavaExec) {
]
inputs.files file("../extendj/java8/grammar/ConstructorReference.ast"),
file("src/main/jastadd/CFG.ast"),
file("src/main/jastadd/CFG.relast"),
file("src/main/jastadd/ClassPathFilter.ast"),
file("../extendj/java8/grammar/IntersectionCasts.ast"),
file("../extendj/java8/grammar/Lambda.ast"),
......
CFG ::= CfgNode*;
/** A node in a Control Flow Graph (CFG). */
abstract CfgNode;
/** The CFG entry node. */
CfgEntry : CfgNode ::= <Succ:CfgNode>;
/** The CFG exit node. */
CfgExit : CfgNode;
CfgNode;
/** A method call in the CFG. */
CfgMethodCall : CfgNode;
/** A conditional branch in the CFG. */
CfgBranch : CfgNode;
/** A branch in the CFG caused by potential thrown exceptions. */
CfgException : CfgNode;
/** A marker node used to mark try block entry points or the end of if-statement branches. */
CfgMarker : CfgNode;
rel CfgNode.successor <-> CfgNode.predecessor ;
rel CfgNode.successor* <-> CfgNode.predecessor* ;
rel CfgEntry ->
// ==== legacy stuff ====
/** The CFG entry node. */
CfgEntry : CfgNode ::= <Succ:CfgNode>;
/** The CFG exit node. */
CfgExit : CfgNode;
/** A conditional branch in the CFG. */
CfgBranch : CfgNode;
......@@ -209,7 +209,7 @@ aspect NullableDereferenceAnalysis {
syn nta CfgMarker Dot.nullableDereferenceMarker() = new CfgMarker();
/** Insert nullable dereference marker in the CFG. */
refine SimpleCFG
refine ReusableCfg
eq Dot.getLeft().follow() =
getRight().isMethodAccess()
? refined()
......
......@@ -104,7 +104,7 @@ aspect PrintCfg {
eq CfgException.dotAttributes() = " [label=\"" + name() + "\",shape=box]";
eq CfgMarker.dotAttributes() = " [label=\"" + name() + "\",shape=box]";
syn String CfgNode.name();
syn String CfgNode.name() = "a node";
eq CfgBranch.name() = branchLabel();
eq CfgEntry.name() = "entry";
eq CfgExit.name() = "exit";
......
class ReusableCfg {
aspect ReusableCfg {
syn CfgNode BodyDecl.emptyCFG() = new CfgNode();
/**
* Get the relational NTA of the CFG. Empty by default.
*/
syn CfgNode BodyDecl.reusableCFG() = emptyCFG();
eq MethodDecl.reusableCFG() = hasBlock() ? getBlock().buildReusableCFG() : emptyCFG();
eq ConstructorDecl.reusableCFG() = getBlock().buildReusableCFG();
/**
* Build the relational NTA of the CFG for a Block.
*/
syn lazy CfgNode Block.buildReusableCFG() {
// CfgNode result = entry(); // TODO alternative: take first expression
CfgNode result = new CfgNode();
if (getNumStmt() == 0) {
// dangling link to a stmt :(
return result;
}
Map<Stmt, CfgNode> cfgNodes = new HashMap<>();
Stmt first = getStmt(0);
result.setStmt(first);
cfgNodes.put(first, result);
Map<CfgNode, Stmt> todo = new HashMap<>();
first.cfgSuccessors().forEach(succ -> todo.put(result, succ));
while (!todo.isEmpty()) {
// Stmt current = todo.pop(); // this should be an tuple (node, successor). to set the relation
CfgNode cfgNodeForPredecessor = todo.entrySet().iterator().next();
Stmt current = todo.remove(predecessor);
CfgNode cfgNodeForCurrent;
if (cfgNodes.containsKey(current)) {
// already processed, only set relation later
cfgNodeForCurrent = cfgNodes.get(current);
} else {
cfgNodeForCurrent = current.cfgMakeCfgNode();
cfgNodes.put(current, cfgNodeForCurrent);
// add successors to be inspected
current.cfgSuccessors().forEach(succ -> todo.put(cfgNodeForCurrent, succ));
}
// set relation
cfgNodeForPredecessor.addSuccessor(cfgNodeForCurrent);
}
return result;
}
syn CfgNode Stmt.cfgMakeCfgNode() = null; // TODO implement
syn Set<Stmt> Stmt.cfgSuccessors() = null; // TODO implement
// ======================== old implementation below ========================
/**
* Find the next CFG node representing the next branch, or the next
* method access following this statement.
......
......@@ -45,7 +45,7 @@ aspect SimpleCFG {
/**
* Successor nodes in the CFG.
*/
syn lazy Set<? extends CfgNode> CfgNode.successors();
syn lazy Collection<? extends CfgNode> CfgNode.successors() = getSuccessors();
eq CfgEntry.successors() = Collections.singleton(getSucc());
......
......@@ -22,8 +22,7 @@ import org.extendj.ast.TypeDecl;
import org.extendj.parser.JavaParser;
import java.io.FileInputStream;
import java.util.HashSet;
import java.util.Set;
import java.util.*;
/**
* Prints a Simplified Control Flow Graph for the first method in a Java program.
......@@ -39,6 +38,7 @@ public class PrintCfg {
private int run(String args[]) {
Set<String> argSet = new HashSet<>();
Map<String,String> m = new HashMap<>();
for (String arg : args) {
argSet.add(arg);
}
......
......@@ -36,8 +36,14 @@ sourceSets.main {
}
}
configurations {
ragdoc
}
dependencies {
testCompile group: 'com.google.truth', name: 'truth', version: '0.27'
ragdoc files('../tools/rd-builder.jar')
}
jastadd {
......@@ -88,6 +94,20 @@ jastadd {
}
ragdoc.group = 'documentation'
task cleanRagdoc(type: Delete) {
group = 'documentation'
delete fileTree('../ragdoc-view/src/data/*')
}
task copyRagdoc(type: Copy, dependsOn: cleanRagdoc) {
group = 'documentation'
description = 'Copy ragdoc json documentation files to ragdoc-viewer'
from 'build/docs/ragdoc'
into '../ragdoc-view/src/data/'
eachFile { println it.file }
}
test {
inputs.dir file('testdata')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment