diff --git a/README.ufbb b/README.ufbb new file mode 100644 index 0000000..ada44b7 --- /dev/null +++ b/README.ufbb @@ -0,0 +1,44 @@ +
+ +# UFB + +`/UFB/*.class` | `UFB.jar` is the interpreter | compiler merged as one. + +Only one file ending in `.ufbb` | `ufb` will be interpreted | compiled. + +A file will not be compiled | interpreted if there are errors. + +
+ +--- + +## Usage + +```shell +java -jar UFB.jar [ -flags ] [ file ] +``` + +--- + +## Flags + +- "-p" -> Performance measurement flag -> ms +- "-n" -> Accurately use the "-p" flag -> ns +- "-m" -> Time all commands being run +- "-v" -> Display semantic version tag +- "-h" -> Display help links and sources +- "-c" -> Compile file + +--- + +## Example + +```shell +java UFB -pnv +java UFB -p +java UFB -m +java UFB -nvp +java UFB -pnhv +java UFB -mn +java UFB -c ../test/UFB/Main.ufb +``` \ No newline at end of file diff --git a/build/UFB.jar b/build/UFB.jar index edd4518..cca64fc 100644 Binary files a/build/UFB.jar and b/build/UFB.jar differ diff --git a/build/UFB/FlagManager.class b/build/UFB/FlagManager.class index a0625dc..18b595a 100644 Binary files a/build/UFB/FlagManager.class and b/build/UFB/FlagManager.class differ diff --git a/build/UFB/Runner.class b/build/UFB/Runner.class index ce7ab65..c926de4 100644 Binary files a/build/UFB/Runner.class and b/build/UFB/Runner.class differ diff --git a/build/UFB/UFB.class b/build/UFB/UFB.class index c4f1321..bc252fa 100644 Binary files a/build/UFB/UFB.class and b/build/UFB/UFB.class differ diff --git a/src/README.md b/src/README.md index ada44b7..4dad4b8 100644 --- a/src/README.md +++ b/src/README.md @@ -27,7 +27,13 @@ java -jar UFB.jar [ -flags ] [ file ] - "-m" -> Time all commands being run - "-v" -> Display semantic version tag - "-h" -> Display help links and sources -- "-c" -> Compile file +- "-c" -> Compile one of the provided files +- "-l" -> Display license notice (GPL v3) + +--- + +(WARNING: NOT RECOMMENDED!): +- "-b" -> Activate backwards compatibility --- diff --git a/src/UFB/FlagManager.java b/src/UFB/FlagManager.java index e7558c6..d89857c 100644 --- a/src/UFB/FlagManager.java +++ b/src/UFB/FlagManager.java @@ -23,9 +23,10 @@ import java.util.regex.Pattern; class FlagManager{ - final boolean[] isActivated=new boolean[6]; + final String flagString="[pnmvhclb]"; + final boolean[] isActivated=new boolean[flagString.length()-2]; final String file; - final Pattern flags=Pattern.compile("[pnmhvc]"); + final Pattern flags=Pattern.compile(flagString); final Pattern repeats=Pattern.compile("(\\w)\\1+"); public FlagManager(final String[]a){ String fileName=""; @@ -43,42 +44,27 @@ else if(arg.startsWith("-")){ "Continuing anyway..." ); } - if(str.contains("p"))isActivated[0]=true; - if(str.contains("n")){ - isActivated[0]=true; - isActivated[1]=true; - } - if(str.contains("m")){ - isActivated[0]=true; - isActivated[2]=true; - } - if(str.contains("v"))isActivated[3]=true; - if(str.contains("h"))isActivated[4]=true; - if(str.contains("c"))isActivated[5]=true; + if(str.contains("p"))isActivated[0]=true; + for(int i=1;i<3;i++) + if(str.contains(flagString.charAt(i+1)+"")) + isActivated[0]=isActivated[i]=true; + for(int i=3;i.\n"); + System.out.printf( + "%s\n%s\n%s\n%s\n%s\n\n", + "----------------------------------------------------------------------------------\n", + license.toString(), + "The copy of the license can be viewed at the root of this repository.\n", + "----------------------------------------------------------------------------------\n", + "Flag triggered, continuing anyway..." + ); + } final String fileName=flagManager.getFileName(); if(fileName.length()==0){ System.out.println("No file input found, terminating."); @@ -76,7 +103,8 @@ public static void main(final String[]a)throws Exception{ fileName, flagManager.isFlagActivated('p'), flagManager.isFlagActivated('n'), - flagManager.isFlagActivated('m') + flagManager.isFlagActivated('m'), + flagManager.isFlagActivated('b') ); } } \ No newline at end of file