From c921b00c99cf46bc33f724581ab9bde2b0d8bb6a Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Thu, 29 Mar 2018 05:27:38 -0400 Subject: update --- RGens/data/new-sample-grammars/cbs.gram | 86 ++++++++++ RGens/data/new-sample-grammars/repinsult.gram | 191 +++++++++++++++++++++ RGens/dotest.sh | 4 + RGens/error.txt | 19 ++ .../main/java/bjc/rgens/newparser/RGrammar.java | 2 +- .../java/bjc/rgens/newparser/RGrammarParser.java | 22 ++- 6 files changed, 311 insertions(+), 13 deletions(-) create mode 100644 RGens/data/new-sample-grammars/cbs.gram create mode 100644 RGens/data/new-sample-grammars/repinsult.gram create mode 100755 RGens/dotest.sh create mode 100644 RGens/error.txt diff --git a/RGens/data/new-sample-grammars/cbs.gram b/RGens/data/new-sample-grammars/cbs.gram new file mode 100644 index 0000000..8d05dd1 --- /dev/null +++ b/RGens/data/new-sample-grammars/cbs.gram @@ -0,0 +1,86 @@ +where + [boss+codirector] → [boss-co] Director + . + [boss+cochief] → [boss-co] Chief + . + [boss+cohead] → [boss-co] Head + . + [boss+copresident] → [boss-co] President + . + [boss+comanager] → [boss-co] Manager + . + [boss-managing] → Managing + Acting + General + . + [boss-vice] → Vice + Vice + Vice + Corporate Vice + {empty} + . + [boss-co] → Co- + {empty} + . +in + [boss-title] → [boss-vice] [boss+codirector] + [boss+cochief] + [boss+cohead] + [boss-vice] [boss+copresident] + Supervisor + [boss+comanager] +end + +[boss-age] → Senior + {empty} + +[boss-exec] → Executive + Principal + {empty} + {empty} + +[boss-groupal] → Group + Global + {empty} + {empty} + +[boss-department] → Human Resources + Controlling + Internal Audit + Legal + Operations + Management Office + Customer Relations + Client Leadership + Client Relationship + Business Planning + Business Operations + IT Strategy + IT Operations + Marketing + Strategic Planning + Facilities Management + Innovation + Identity + Branding + Diversity and Exclusion + +[boss-departmentrole] → [boss-department] + [boss-department] + [boss-department] + [boss-department] + [boss-department] + Visionary + Digital + Technical + Manifesto + +[boss-catalyst] → Catalyst + Futurist + Officer + Officer + +[boss] → [boss-managing] [boss-age] [boss-exec] [boss-title] of +[boss-department] + [boss-groupal] Chief [boss-departmentrole] [boss-catalyst] + diff --git a/RGens/data/new-sample-grammars/repinsult.gram b/RGens/data/new-sample-grammars/repinsult.gram new file mode 100644 index 0000000..ab63fb9 --- /dev/null +++ b/RGens/data/new-sample-grammars/repinsult.gram @@ -0,0 +1,191 @@ +[rep-insult] [brag-verb] [rude-phrase] [rude-scapegoat] + +[brag-verb] → abolish + ban + bash + beat + blast + bomb + bury + clobber + demolish + drive SUVs over + flatten + glassify + kill + napalm + nuke + outlaw + overwhelm + screw + shoot + silence + steam-roller + wipe + +[rude-adj] → AIDS-infested + America-hating + Arab + ass-pounding + bleeding heart + boy-fucking + camel-fucking + camel-humping + camel-raping + cocksucking + bullshitting + Bush-hating + butt-banging + Chomsky-loving + Christ-hating + clueless + communist + cornholing + crazy + crying + dammed + DemocRAT + Democrat + disgusting + disobedient + disrespectful + fat + fat-assed + feel-goog + flag-hating + flag-burning + flaming + freedom-hating + French + Hitler-loving + holocaust-denying + homo + illegal + impractical + insane + Jesus-hating + koran-owning + left-wing + limp-wristed + lying + mendacious + moonbat + moronic + queer + rebellious + Saddam-loving + sick + skinny-assed + socialist + spamming + stupid + teflon + tin hat + unemployed + whining + wimpoid + +[rude-noun] → alien + America-hater + animal + Arab + assclown + asshole + atheist + bastard + black + bullshitter + bum biter + Bush-hater + Canadian + camel jockey + camel humper + camel kisser + Canuck + Canukistani + cheesehead + cheese-eater + child molester + chink + Chomskyite + Clinton-lover + Clintonite + cock sucker + commie + communist + conspiracy theorist + crackpot + creep + cum-drinker + dog-fucker + environmentalist + European + faggot + fart + fruitcake + gay boy + girlie-man + hate monger + homo idiot + Jew + Jew-boy + ketchup-eater + koran reader + leftie + liar + Liberal + LIEberal + loon + loser + luser + maggot + maroon + Mexican + Mooseslime + moron + Muslim + newbie + nigger + nutbar + pedophile + person with AIDS + pervert + piece of trash + pinko + pond sucker + queer + raghead + retard + Saddam-lover + Saddamocrat + sand monkey + sand nigger + scumbag + SOB + socialist + sock puppet + spammer + terrorist + trailer park scum + traitor + tree-hugger + vulture sock puppet + wannabe + welfare bum + wetback + whacko + wing nut + woman + +[rude-scapegoat] → AIDS carriers + Arabs + atheists + Bill Clinton + Bill + Billary + blacks + baby-killer + Bush-haters + Canadians + Canucks + Can diff --git a/RGens/dotest.sh b/RGens/dotest.sh new file mode 100755 index 0000000..b2b43b9 --- /dev/null +++ b/RGens/dotest.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +mvn clean compile exec:java > outp.txt 2> error.txt; tail -n +35 outp.txt \ +| view -c "normal! zR" -; diff --git a/RGens/error.txt b/RGens/error.txt new file mode 100644 index 0000000..4a64ce9 --- /dev/null +++ b/RGens/error.txt @@ -0,0 +1,19 @@ +bjc.rgens.newparser.GrammarException: Error in generating case (bjc.rgens.newparser.RuleCase@3508d5aa) + at bjc.rgens.newparser.RGrammar.generateCase(RGrammar.java:247) + at bjc.rgens.newparser.RGrammar.generate(RGrammar.java:178) + at bjc.rgens.newparser.RGrammar.generate(RGrammar.java:138) + at bjc.rgens.newparser.RGrammarTest.main(RGrammarTest.java:45) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.lang.reflect.Method.invoke(Method.java:498) + at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297) + at java.lang.Thread.run(Thread.java:748) +Caused by: bjc.rgens.newparser.GrammarException: Error in generating case element ([Monster/Animals]) + at bjc.rgens.newparser.RGrammar.generateElement(RGrammar.java:282) + at bjc.rgens.newparser.RGrammar.generateCase(RGrammar.java:229) + ... 9 more +Caused by: bjc.rgens.newparser.GrammarException: No rule '[Monster/Animals]' defined (perhaps you meant ?) + at bjc.rgens.newparser.RGrammar.generateRuleReference(RGrammar.java:397) + at bjc.rgens.newparser.RGrammar.generateElement(RGrammar.java:259) + ... 10 more diff --git a/RGens/src/main/java/bjc/rgens/newparser/RGrammar.java b/RGens/src/main/java/bjc/rgens/newparser/RGrammar.java index 3ffb4b2..8c6fd7d 100644 --- a/RGens/src/main/java/bjc/rgens/newparser/RGrammar.java +++ b/RGens/src/main/java/bjc/rgens/newparser/RGrammar.java @@ -202,7 +202,7 @@ public class RGrammar { body = body.replaceAll("([)\\]])\\s+([)\\]])", "$1$2"); /* Handle inter-word punctuation. */ - body = body.replaceAll(" ([,:.])", "$1 "); + body = body.replaceAll(" ([,:.!])", "$1 "); /* Handle intra-word punctuation. */ body = body.replaceAll("\\s?([-/])\\s?", "$1"); diff --git a/RGens/src/main/java/bjc/rgens/newparser/RGrammarParser.java b/RGens/src/main/java/bjc/rgens/newparser/RGrammarParser.java index 3d2c921..cf33967 100644 --- a/RGens/src/main/java/bjc/rgens/newparser/RGrammarParser.java +++ b/RGens/src/main/java/bjc/rgens/newparser/RGrammarParser.java @@ -368,19 +368,17 @@ public class RGrammarParser { String ctxDelim = String.format(TMPL_TOPLEVEL_BLOCK_DELIM, level + 1); try (BlockReader bodyReader = new SimpleBlockReader(ctxDelim, ctxReader)) { - + Block whereBody = whereReader.next(); + + /** + * @TODO 10/11/17 Ben Culkin :WhereBlocks + * Implement where blocks. + * + * A where block has the context evaluated + * in a new context, and the body executed + * in that context. + */ } - - Block whereBody = whereReader.next(); - - /** - * @TODO 10/11/17 Ben Culkin :WhereBlocks - * Implement where blocks. - * - * A where block has the context evaluated - * in a new context, and the body executed - * in that context. - */ } catch (GrammarException gex) { throw new GrammarException(String.format("Error in where block (%s)", whereReader.getBlock()), gex); -- cgit v1.2.3