diff options
author | Araq <rumpf_a@web.de> | 2011-04-11 23:28:53 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-04-11 23:28:53 +0200 |
commit | 46c41e43690cba9bc1caff6a994bb6915df8a1b7 (patch) | |
tree | c96be792eceb1d189cdb5bcff6e1a06f9b51e76c /tests/accept/run | |
parent | 3d696c3da53e5c41d839d8265fbc94f1c64980bb (diff) | |
download | Nim-46c41e43690cba9bc1caff6a994bb6915df8a1b7.tar.gz |
p[] instead of p^
Diffstat (limited to 'tests/accept/run')
-rw-r--r-- | tests/accept/run/tnewderef.nim | 11 | ||||
-rwxr-xr-x | tests/accept/run/tpegs.nim | 16 |
2 files changed, 19 insertions, 8 deletions
diff --git a/tests/accept/run/tnewderef.nim b/tests/accept/run/tnewderef.nim new file mode 100644 index 000000000..89dc4c8d1 --- /dev/null +++ b/tests/accept/run/tnewderef.nim @@ -0,0 +1,11 @@ +discard """ + output: 3 + +""" + +var x: ref int +new(x) +x[] = 3 + +echo x[] + diff --git a/tests/accept/run/tpegs.nim b/tests/accept/run/tpegs.nim index c127f6fec..c3ca7c9ab 100755 --- a/tests/accept/run/tpegs.nim +++ b/tests/accept/run/tpegs.nim @@ -115,7 +115,7 @@ proc charSet*(s: set[char]): TPeg {.rtl, extern: "npegs$1".} = assert '\0' notin s result.kind = pkCharChoice new(result.charChoice) - result.charChoice^ = s + result.charChoice[] = s proc len(a: TPeg): int {.inline.} = return a.sons.len proc add(d: var TPeg, s: TPeg) {.inline.} = add(d.sons, s) @@ -130,7 +130,7 @@ proc copyPeg(a: TPeg): TPeg = result.ch = a.ch of pkCharChoice, pkGreedyRepSet: new(result.charChoice) - result.charChoice^ = a.charChoice^ + result.charChoice[] = a.charChoice[] of pkNonTerminal: result.nt = a.nt of pkBackRef..pkBackRefIgnoreStyle: result.index = a.index @@ -143,9 +143,9 @@ proc addChoice(dest: var TPeg, elem: TPeg) = # caution! Do not introduce false aliasing here! case elem.kind of pkCharChoice: - dest.sons[L] = charSet(dest.sons[L].charChoice^ + elem.charChoice^) + dest.sons[L] = charSet(dest.sons[L].charChoice[] + elem.charChoice[]) of pkChar: - dest.sons[L] = charSet(dest.sons[L].charChoice^ + {elem.ch}) + dest.sons[L] = charSet(dest.sons[L].charChoice[] + {elem.ch}) else: add(dest, elem) else: add(dest, elem) @@ -447,7 +447,7 @@ proc toStrAux(r: TPeg, res: var string) = add(res, 'y') add(res, singleQuoteEsc(r.term)) of pkChar: add(res, singleQuoteEsc(r.ch)) - of pkCharChoice: add(res, charSetEsc(r.charChoice^)) + of pkCharChoice: add(res, charSetEsc(r.charChoice[])) of pkNonTerminal: add(res, r.nt.name) of pkSequence: add(res, '(') @@ -470,7 +470,7 @@ proc toStrAux(r: TPeg, res: var string) = add(res, singleQuoteEsc(r.ch)) add(res, '*') of pkGreedyRepSet: - add(res, charSetEsc(r.charChoice^)) + add(res, charSetEsc(r.charChoice[])) add(res, '*') of pkGreedyAny: add(res, ".*") @@ -652,7 +652,7 @@ proc rawMatch*(s: string, p: TPeg, start: int, c: var TCaptures): int {. if p.ch == s[start]: result = 1 else: result = -1 of pkCharChoice: - if contains(p.charChoice^, s[start]): result = 1 + if contains(p.charChoice[], s[start]): result = 1 else: result = -1 of pkNonTerminal: var oldMl = c.ml @@ -719,7 +719,7 @@ proc rawMatch*(s: string, p: TPeg, start: int, c: var TCaptures): int {. while ch == s[start+result]: inc(result) of pkGreedyRepSet: result = 0 - while contains(p.charChoice^, s[start+result]): inc(result) + while contains(p.charChoice[], s[start+result]): inc(result) of pkOption: result = max(0, rawMatch(s, p.sons[0], start, c)) of pkAndPredicate: |