This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/jvm/clojure/lang/Numbers.java b/src/jvm/clojure/lang/Numbers.java | |
index 0400208..7d40db4 100644 | |
--- a/src/jvm/clojure/lang/Numbers.java | |
+++ b/src/jvm/clojure/lang/Numbers.java | |
@@ -295,6 +295,8 @@ static public Number divide(BigInteger n, BigInteger d){ | |
d = d.divide(gcd); | |
if(d.equals(BigInteger.ONE)) | |
return reduce(n); | |
+ else if(d.equals(BigInteger.ONE.negate())) | |
+ return reduce(n.negate()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn dostuff [x] | |
(try | |
(cond (vector? x) | |
(let [r (for [x x] (dostuff x))] | |
(apply concat r)) | |
(integer? x) | |
(throw (java.text.ParseException. "blah" 0)) | |
(string? x) | |
(throw (NoSuchMethodException. x)) | |
:else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(for [x (.getURLs (ClassLoader/getSystemClassLoader))] (.getFile x)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- JavaScript.stg 2009-09-23 20:36:12.000000000 +0200 | |
+++ JavaScript.stg 2010-09-29 14:14:46.262238708 +0200 | |
@@ -243,7 +243,7 @@ | |
/** How to generate a tree parser; same as parser except the input | |
* stream is a different type. | |
*/ | |
-treeParser(grammar, name, scopes, tokens, tokenNames, globalAction, rules, numRules, bitsets, labelType={<ASTLabelType>}, ASTLabelType="var", superClass="tree.TreeParser", members={<actions.treeparser.members>}) ::= << | |
+treeParser(grammar, name, scopes, tokens, tokenNames, globalAction, rules, numRules, bitsets, labelType={<ASTLabelType>}, ASTLabelType="var", superClass="tree.TreeParser", members={<actions.treeparser.members>}, filterMode) ::= << | |
<genericParser(inputStreamType="TreeNodeStream", rewriteElementType="Node", ...)> | |
>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- ASTParser.stg 2010-09-30 14:38:18.191624873 +0200 | |
+++ ASTParser.stg 2009-09-23 20:36:10.000000000 +0200 | |
@@ -84,7 +84,7 @@ | |
matchSetRuleRoot(s,label,hetero,elementIndex,debug) ::= << | |
<if(label)> | |
-<label>=this.input.LT(1);//blah!<\n> | |
+<label>=input.LT(1);<\n> | |
<endif> | |
<super.matchSet(..., postmatchCode={<if(backtracking)>if ( <actions.(actionScope).synpredgate> ) <endif>root_0 = this.adaptor.becomeRoot(<createNodeFromToken(...)>, root_0);})> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grammar SimpleCalc; | |
options { | |
language=JavaScript; | |
output=AST; | |
ASTLabelType=CommonTree; | |
} | |
tokens { | |
NEGATION; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tree grammar SimpleCalcWalker; | |
options { | |
language=JavaScript; | |
tokenVocab=SimpleCalc; | |
ASTLabelType=CommonTree; | |
} | |
eval returns [var result] | |
: e=math EOF { result = e; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the lib/ directory contains all the requirements for antlr, which are | |
# antlr-3.2/tool/target/antlr-3.2.jar | |
# antlr-3.2/runtime/Java/target/antlr-runtime-3.2.jar | |
# antlr-2.7.7.jar, which should be in your maven repository | |
# e.g., ~/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar | |
# and stringtemplate-3.2.1.jar which should also be in your maven repository | |
# e.g., ~/.m2/repository/org/antlr/stringtemplate/3.2.1/stringtemplate-3.2.1.jar | |
java -cp 'lib/*' org.antlr.Tool SimpleCalc.g | |
java -cp 'lib/*' org.antlr.Tool SimpleCalcWalker.g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type="text/javascript" src="antlr3-all.js"></script> | |
<script type="text/javascript" src="SimpleCalcLexer.js"></script> | |
<script type="text/javascript" src="SimpleCalcParser.js"></script> | |
<script type="text/javascript" src="SimpleCalcWalker.js"></script> | |
<script type="text/javascript"> | |
function parse() { | |
var input = document.getElementById("expr").value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BASE_DIR=/tmp | |
mv $BASE_DIR/couchdb.log $BASE_DIR/couchdb-`date +%Y-%m-%d -d 'yesterday'`.log | |
touch $BASE_DIR/couchdb.log | |
LAST_WEEK=$BASE_DIR/couchdb-`date +%Y-%m-%d -d '8 days ago'`.log | |
if [ -a $LAST_WEEK ] | |
then | |
rm $LAST_WEEK | |
fi |
OlderNewer