- /** tell whether we are at end of string */\r
- public boolean eos() { return eos; }\r
- /** initialize a StrPos from another StrPos. */\r
- public StrPos(StrPos sp) {\r
- dup(sp);\r
+ /** copy a StrPos from sp to this. */\r
+ public void dup(StrPos sp)\r
+ {\r
+ s = sp.s;\r
+ pos = sp.pos;\r
+ c = sp.c;\r
+ dontMatch = sp.dontMatch;\r
+ eos = sp.eos;\r
+ }\r
+\r
+ /** Initialize a StrPos by giving it a String, and a\r
+ position within the String. */\r
+ public StrPos(String s, int pos)\r
+ {\r
+ this.s = s;\r
+ this.pos = pos - 1;\r
+ inc();\r
+ }\r
+\r
+ /** Advance the place where StrPos points within the String.\r
+ Counts a backslash as part of the next character. */\r
+ public StrPos inc()\r
+ {\r
+ pos++;\r
+ if (pos >= s.length())\r
+ {\r
+ eos = true;\r
+ return this;\r