mirror of
https://github.com/corda/corda.git
synced 2025-01-09 06:23:04 +00:00
944f5f3567
So far, these are humble beginnings indeed. Based on the descriptions of http://swtch.com/%7Ersc/regexp/regexp2.html I started implementing a Thompson NFA / Pike VM. The idea being that eventually, regular expressions are to be compiled into special-purpose bytecode for the Pike VM that executes a varying number of threads in lock-step over each character of the text to match. The thread count is bounded by the length of the program: two different threads with identical instruction pointer at the same character-to-match would yield exactly the same outcome (and therefore, we can execute just one such thread instead of possibly many). To allow for matching groups, each thread carries a state with it, saving the group offsets acquired so far. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
29 lines
686 B
Java
29 lines
686 B
Java
/* Copyright (c) 2008-2013, Avian Contributors
|
|
|
|
Permission to use, copy, modify, and/or distribute this software
|
|
for any purpose with or without fee is hereby granted, provided
|
|
that the above copyright notice and this permission notice appear
|
|
in all copies.
|
|
|
|
There is NO WARRANTY for this software. See license.txt for
|
|
details. */
|
|
|
|
package regex;
|
|
|
|
/**
|
|
* Opcodes for the Pike VM.
|
|
* <p>
|
|
* See {@link PikeVM}.
|
|
* </p>
|
|
*
|
|
* @author Johannes Schindelin
|
|
*/
|
|
interface PikeVMOpcodes {
|
|
final static int CHAR = 1;
|
|
final static int DOT = 2;
|
|
final static int DOTALL = 3;
|
|
final static int SAVE_OFFSET = 4;
|
|
final static int SPLIT = 5;
|
|
final static int JMP = 6;
|
|
}
|