mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-19 09:54:49 -04:00
fixed a bug in the test data parser
This commit is contained in:
parent
eb1fa408e3
commit
f7bdfb672c
@ -1,2 +1,2 @@
|
||||
#!/bin/bash
|
||||
java -jar Digital.jar $1
|
||||
java -jar Digital.jar "$1"
|
@ -14,19 +14,6 @@ werden durch die Und-Gatter implementiert. </string>
|
||||
</entry>
|
||||
</attributes>
|
||||
<visualElements>
|
||||
<visualElement>
|
||||
<elementName>Testcase</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Testdata</string>
|
||||
<testData>
|
||||
<dataString> A B Y
|
||||
repeat(1<<16) (n&0xff) (n>>8) ((n&0xff)*(n>>8))</dataString>
|
||||
</testData>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="1220" y="900"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
@ -800,6 +787,23 @@ repeat(1<<16) (n&0xff) (n>>8) ((n&0xff)*(n>>8))</dataS
|
||||
</elementAttributes>
|
||||
<pos x="240" y="260"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Testcase</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Testdata</string>
|
||||
<testData>
|
||||
<dataString> A B Y
|
||||
loop(a,1<<8)
|
||||
loop(b,1<<8)
|
||||
(a) (b) (a*b)
|
||||
end loop
|
||||
end loop</dataString>
|
||||
</testData>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="1220" y="880"/>
|
||||
</visualElement>
|
||||
</visualElements>
|
||||
<wires>
|
||||
<wire>
|
@ -7,7 +7,7 @@ import de.neemann.digital.lang.Lang;
|
||||
* Created by hneemann on 19.04.17.
|
||||
*/
|
||||
public class LineEmitterRepeat implements LineEmitter {
|
||||
private static final int MAX_LOOPS = 1 << 24;
|
||||
private static final long MAX_LOOPS = 1L << 24;
|
||||
|
||||
private final String name;
|
||||
private final int size;
|
||||
@ -21,9 +21,9 @@ public class LineEmitterRepeat implements LineEmitter {
|
||||
* @param inner the lines to repeat
|
||||
* @throws ParserException if there are to many iterations
|
||||
*/
|
||||
public LineEmitterRepeat(String name, int size, LineEmitter inner) throws ParserException {
|
||||
public LineEmitterRepeat(String name, long size, LineEmitter inner) throws ParserException {
|
||||
this.name = name;
|
||||
this.size = size;
|
||||
this.size = (int) size;
|
||||
this.inner = inner;
|
||||
|
||||
if (size > MAX_LOOPS)
|
||||
|
@ -102,7 +102,7 @@ public class Parser {
|
||||
case REPEAT:
|
||||
tok.consume();
|
||||
expect(Tokenizer.Token.OPEN);
|
||||
int count = (int) parseInt();
|
||||
long count = parseInt();
|
||||
expect(Tokenizer.Token.CLOSE);
|
||||
list.add(new LineEmitterRepeat("n", count, parseSingleRow()));
|
||||
break;
|
||||
@ -112,7 +112,7 @@ public class Parser {
|
||||
expect(Tokenizer.Token.IDENT);
|
||||
String var = tok.getIdent();
|
||||
expect(Tokenizer.Token.COMMA);
|
||||
count = (int) parseInt();
|
||||
count = parseInt();
|
||||
expect(Tokenizer.Token.CLOSE);
|
||||
list.add(new LineEmitterRepeat(var, count, parseRows(Tokenizer.Token.LOOP)));
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user