summary refs log tree commit diff stats
path: root/lib/pure/pegs.nim
Commit message (Expand)AuthorAgeFilesLines
* Fix modules that import both strutils and unicodeJoey Payne2016-07-011-2/+2
* documentation build cleaned upAndreas Rumpf2016-05-311-1/+1
* Pegs: fixes edge caseAndreas Rumpf2016-05-121-2/+6
* Added a replace() proc using a callback to pegs.Hans Raaf2016-05-071-0/+59
* Merge branch 'devel'Dominik Picheta2015-10-271-24/+24
|\
| * renamed writeln to writeLine in libpatrick dw2015-06-191-1/+1
| * no private deprecated symbolsAraq2015-06-101-1/+0
| * lib/pure/p-t - Dropped 'T' from typespdw2015-06-041-23/+24
* | Replace "prefix" with "suffix" in endsWith docFederico Ceratto2015-10-231-1/+1
|/
* fixes match on empty peg match, #2354Simon Hafner2015-03-221-20/+26
* fixes #2205Araq2015-03-071-155/+155
* Get rid of deprecation warnings in pegsdef2015-01-161-1/+1
* minor improvementsAraq2014-12-281-1/+1
* fixes #1496Araq2014-12-181-1/+1
* fixes regression that caused pegs to not compileAraq2014-11-291-1/+1
* pegs module compiles againAraq2014-11-281-1/+1
* Modify pegs.nim such that no match will return nilFlaviu Tamas2014-10-291-1/+17
* updated pegs moduleAraq2014-08-281-38/+38
* big renameAraq2014-08-271-140/+132
* distinguish between 'defined' and 'declared'Araq2014-08-111-1/+1
* Rewrote the changes to findAll using if/elseFabio Cevasco2014-02-221-3/+3
* pegs.findAll iterator fixFabio Cevasco2014-02-211-1/+3
* updated grammar.txtAraq2014-01-201-4/+4
* case consistency part 6Araq2013-12-281-64/+64
* made tests greenAraq2013-06-101-1/+1
* manyloc test should be green againAraq2013-06-041-1/+0
* pegs/re =~ warns about scope rule change; improved docsAraq2013-05-081-2/+2
* pegs compiles againAraq2013-05-021-1/+2
* bugfixes mostly JS relatedAraq2013-05-011-3/+5
* Removes executable bit for text files.Grzegorz Adam Hankiewicz2013-03-161-0/+0
* objects with no ancestor are not implicitely finalAraq2012-08-241-1/+1
* first steps to make templates hygienicAraq2012-08-201-1/+4
* openarray/varargs split; breaks bootstrappingAraq2012-08-161-4/+4
* Both the re and pegs module's `=~` templates can now be used simultaneously f...Dominik Picheta2012-07-211-1/+1
* fixes #113Araq2012-05-201-4/+4
* fixes #114Araq2012-05-201-2/+2
* Merge branch 'master' of github.com:Araq/NimrodAraq2012-04-151-1/+0
|\
| * minor changes to make the test suite green againZahary Karadjov2012-04-151-1/+0
* | @ is a sigil-like operatorAraq2012-04-151-7/+7
|/
* documentation improvements; higher level Mongodb wrapperAraq2012-04-091-2/+2
* year 2012 for most copyright headersAraq2012-01-021-1/+1
* tester checks exitcode; osproc additions; DLL fixes; taint mode fixesAraq2011-11-071-1/+1
* code generator supports constant sequences; more consistent compile time eval...Araq2011-10-071-5/+5
* pegs module: bugfixes for the anchor ^; pegs.replace now does what the docs sayAraq2011-06-161-24/+52
* readFile raises EIO instead of returning nil; added system.writeFileAraq2011-06-161-10/+2
* deprecated system.copy: use system.substr insteadAraq2011-05-141-8/+8
* p[] instead of p^Araq2011-04-111-7/+7
* some little bugfixesAraq2011-03-271-1/+1
* bugfixes; field discriminant checks; linearScanEnd, unroll, shallow pragmasAraq2011-03-231-5/+10
* distinction between re.replace and re.replacef; speed improvements for re moduleAraq2011-03-061-4/+20
trace(Callstack_depth+1, "run") << "effective address is 0x" << HEXWORD << addr << end(); } else { const uint8_t scale = (1 << (sib>>6)); addr += Reg[index].i*scale; // treat index register as signed. Maybe base as well? But we'll always ensure it's non-negative. trace(Callstack_depth+1, "run") << "effective address is 0x" << HEXWORD << addr << " (after adding " << rname(index) << "*" << NUM(scale) << ")" << end(); } return addr; } :(code) void test_add_r32_to_mem_at_base_r32_index_r32() { Reg[EBX].i = 0x10; // source Reg[EAX].i = 0x1ffe; // dest base Reg[ECX].i = 0x2; // dest index run( "== code 0x1\n" // op ModR/M SIB displacement immediate " 01 1c 08 \n" // add EBX to *(EAX+ECX) // ModR/M in binary: 00 (indirect mode) 011 (src EBX) 100 (dest in SIB) // SIB in binary: 00 (scale 1) 001 (index ECX) 000 (base EAX) "== data 0x2000\n" "01 00 00 00\n" // 0x00000001 ); CHECK_TRACE_CONTENTS( "run: add EBX to r/m32\n" "run: effective address is initially 0x00001ffe (EAX)\n" "run: effective address is 0x00002000 (after adding ECX*1)\n" "run: storing 0x00000011\n" ); } :(code) void test_add_r32_to_mem_at_displacement_using_sib() { Reg[EBX].i = 0x10; // source run( "== code 0x1\n" // op ModR/M SIB displacement immediate " 01 1c 25 00 20 00 00 \n" // add EBX to *0x2000 // ModR/M in binary: 00 (indirect mode) 011 (src EBX) 100 (dest in SIB) // SIB in binary: 00 (scale 1) 100 (no index) 101 (not EBP but disp32) "== data 0x2000\n" "01 00 00 00\n" // 0x00000001 ); CHECK_TRACE_CONTENTS( "run: add EBX to r/m32\n" "run: effective address is initially 0x00002000 (disp32)\n" "run: effective address is 0x00002000\n" "run: storing 0x00000011\n" ); } //: :(code) void test_add_r32_to_mem_at_base_r32_index_r32_plus_disp8() { Reg[EBX].i = 0x10; // source Reg[EAX].i = 0x1ff9; // dest base Reg[ECX].i = 0x5; // dest index run( "== code 0x1\n" // op ModR/M SIB displacement immediate " 01 5c 08 02 \n" // add EBX to *(EAX+ECX+2) // ModR/M in binary: 01 (indirect+disp8 mode) 011 (src EBX) 100 (dest in SIB) // SIB in binary: 00 (scale 1) 001 (index ECX) 000 (base EAX) "== data 0x2000\n" "01 00 00 00\n" // 0x00000001 ); CHECK_TRACE_CONTENTS( "run: add EBX to r/m32\n" "run: effective address is initially 0x00001ff9 (EAX)\n" "run: effective address is 0x00001ffe (after adding ECX*1)\n" "run: effective address is 0x00002000 (after adding disp8)\n" "run: storing 0x00000011\n" ); } :(before "End Mod 1 Special-cases(addr)") case 4: // exception: mod 0b01 rm 0b100 => incoming SIB (scale-index-base) byte addr = effective_address_from_sib(mod); break; //: :(code) void test_add_r32_to_mem_at_base_r32_index_r32_plus_disp32() { Reg[EBX].i = 0x10; // source Reg[EAX].i = 0x1ff9; // dest base Reg[ECX].i = 0x5; // dest index run( "== code 0x1\n" // op ModR/M SIB displacement immediate " 01 9c 08 02 00 00 00 \n" // add EBX to *(EAX+ECX+2) // ModR/M in binary: 10 (indirect+disp32 mode) 011 (src EBX) 100 (dest in SIB) // SIB in binary: 00 (scale 1) 001 (index ECX) 000 (base EAX) "== data 0x2000\n" "01 00 00 00\n" // 0x00000001 ); CHECK_TRACE_CONTENTS( "run: add EBX to r/m32\n" "run: effective address is initially 0x00001ff9 (EAX)\n" "run: effective address is 0x00001ffe (after adding ECX*1)\n" "run: effective address is 0x00002000 (after adding disp32)\n" "run: storing 0x00000011\n" ); } :(before "End Mod 2 Special-cases(addr)") case 4: // exception: mod 0b10 rm 0b100 => incoming SIB (scale-index-base) byte addr = effective_address_from_sib(mod); break;