Skip to content

Commit

Permalink
upload without errrors
Browse files Browse the repository at this point in the history
  • Loading branch information
stigito committed Mar 23, 2018
1 parent d7949f4 commit 247fbf7
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 9 deletions.
10 changes: 10 additions & 0 deletions .checkstyle
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>

<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
<local-check-config name="Schiedermeier" location="C:\Users\Stigi\OneDrive\Hochschule_Muenchen\4.Semester\Compiler\checkstyle.xml" type="external" description="">
<additional-data name="protect-config-file" value="false"/>
</local-check-config>
<fileset name="all" enabled="true" check-config-name="Hammer" local="false">
<file-match-pattern match-pattern="." include-pattern="true"/>
</fileset>
</fileset-config>
6 changes: 6 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
</natures>
</projectDescription>
Binary file modified bin/edu/hm/stiglmeier/andreas/praeproc/PraeProzessor.class
Binary file not shown.
30 changes: 21 additions & 9 deletions src/edu/hm/stiglmeier/andreas/praeproc/PraeProzessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private enum STATE {
/**
* dummy.
*/
private int state;
private final int state;

/**
* dummy javadoc.
Expand Down Expand Up @@ -70,34 +70,39 @@ public PraeProzessor() {

/**
* dummy javadoc.
* @param unprocessed dummy.
*/
@Override
public Source process(Source unprocessed) throws LexicalError {

final Source processed = new Source();
int state = STATE.NORMAL.getState(); // resetting automat
String buffer = "";
while(unprocessed.hasMore()) {
state = processChar(processed, unprocessed.getNextChar(), state);
char character = 0;
while (unprocessed.hasMore()) {
character = unprocessed.getNextChar();
state = processChar(processed, character, state);
}

if(state >= 2) {
if (state == 1) { // append '/'
processed.append(character);
}
if (state >= 2) {
throw new LexicalError();
}
processed.append(buffer);
return processed;
}

/**
* dummy javadoc.
* @param character dummy.
* @param processed dummy.
* @return dummy.
*/
private int processChar(Source processed, char character, int state) {
switch(state) {
case 0:
return processNormal(processed, character);
case 1:
case 1:
return processComm(processed, character);
case 2:
return processCommLine(processed, character);
Expand All @@ -113,6 +118,7 @@ private int processChar(Source processed, char character, int state) {
/**
* dummy javadoc.
* @param character dummy.
* @param processed dummy.
* @return dummy.
*/
private int processNormal(Source processed, char character) {
Expand All @@ -128,13 +134,14 @@ private int processNormal(Source processed, char character) {
/**
* dummy javadoc.
* @param character dummy.
* @param processed dummy.
* @return dummy.
*/
private int processComm(Source processed, char character) {
if (character == '/') {
return STATE.COMMLINE.getState();
}
else if(character == '*') {
else if (character == '*') {
return STATE.COMMBLOCK.getState();
}
else {
Expand All @@ -146,10 +153,12 @@ else if(character == '*') {
/**
* dummy javadoc.
* @param character dummy.
* @param processed dummy.
* @return dummy.
*/
private int processCommLine(Source processed, char character) {
if (character == '\n') {
processed.append(character);
return STATE.NORMAL.getState();
}
else {
Expand All @@ -160,6 +169,7 @@ private int processCommLine(Source processed, char character) {
/**
* dummy javadoc.
* @param character dummy.
* @param processed dummy.
* @return dummy.
*/
private int processCommBlock(Source processed, char character) {
Expand All @@ -176,14 +186,15 @@ else if (character == '\n') {
/**
* dummy javadoc.
* @param character dummy.
* @param processed dummy.
* @return dummy.
*/
private int processCommBlockEnd(Source processed, char character) {
if (character == '/') {
processed.append(' ');
return STATE.NORMAL.getState();
}
else if(character == '*') {
else if (character == '*') {
return STATE.COMMBLOCKEND.getState();
}
else if (character == '\n') {
Expand All @@ -196,6 +207,7 @@ else if (character == '\n') {
/**
* dummy javadoc.
* @param character dummy.
* @param processed dummy.
* @return dummy.
*/
private int proceedNormal(Source processed, char character) {
Expand Down
4 changes: 4 additions & 0 deletions test.mini
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/***/x

/*
sacsanvdnv
*/
/x
// sdsaf
// / scsv// aja
Expand Down

0 comments on commit 247fbf7

Please sign in to comment.