You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ar...@apache.org on 2006/06/04 04:41:25 UTC
svn commit: r411501 [5/30] - in /incubator/lucene.net/trunk/C#/src: ./
Demo/DeleteFiles/ Demo/DemoLib/ Demo/DemoLib/HTML/ Demo/IndexFiles/
Demo/IndexHtml/ Demo/SearchFiles/ Lucene.Net/ Lucene.Net/Analysis/
Lucene.Net/Analysis/Standard/ Lucene.Net/Docum...
Modified: incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/ParseException.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/DemoLib/HTML/ParseException.cs?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/ParseException.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/ParseException.cs Sat Jun 3 19:41:13 2006
@@ -15,214 +15,216 @@
*/
/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */
+
using System;
+
namespace Lucene.Net.Demo.Html
{
- /// <summary> This exception is thrown when parse errors are encountered.
- /// You can explicitly create objects of this exception type by
- /// calling the method generateParseException in the generated
- /// parser.
- ///
- /// You can modify this class to customize your error reporting
- /// mechanisms so long as you retain the public fields.
- /// </summary>
- [Serializable]
- public class ParseException:System.Exception
- {
- /// <summary> This method has the standard behavior when this object has been
- /// created using the standard constructors. Otherwise, it uses
- /// "currentToken" and "expectedTokenSequences" to generate a parse
- /// error message and returns it. If this object has been created
- /// due to a parse error, and you do not catch it (it gets thrown
- /// from the parser), then this method is called during the printing
- /// of the final stack trace, and hence the correct error message
- /// gets displayed.
- /// </summary>
- public override System.String Message
- {
- get
- {
- if (!specialConstructor)
- {
- return base.Message;
- }
- System.String expected = "";
- int maxSize = 0;
- for (int i = 0; i < expectedTokenSequences.Length; i++)
- {
- if (maxSize < expectedTokenSequences[i].Length)
- {
- maxSize = expectedTokenSequences[i].Length;
- }
- for (int j = 0; j < expectedTokenSequences[i].Length; j++)
- {
- expected += (tokenImage[expectedTokenSequences[i][j]] + " ");
- }
- if (expectedTokenSequences[i][expectedTokenSequences[i].Length - 1] != 0)
- {
- expected += "...";
- }
- expected += (eol + " ");
- }
- System.String retval = "Encountered \"";
- Token tok = currentToken.next;
- for (int i = 0; i < maxSize; i++)
- {
- if (i != 0)
- retval += " ";
- if (tok.kind == 0)
- {
- retval += tokenImage[0];
- break;
- }
- retval += Add_Escapes(tok.image);
- tok = tok.next;
- }
- retval += ("\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn);
- retval += ("." + eol);
- if (expectedTokenSequences.Length == 1)
- {
- retval += ("Was expecting:" + eol + " ");
- }
- else
- {
- retval += ("Was expecting one of:" + eol + " ");
- }
- retval += expected;
- return retval;
- }
+ /// <summary> This exception is thrown when parse errors are encountered.
+ /// You can explicitly create objects of this exception type by
+ /// calling the method generateParseException in the generated
+ /// parser.
+ ///
+ /// You can modify this class to customize your error reporting
+ /// mechanisms so long as you retain the public fields.
+ /// </summary>
+ [Serializable]
+ public class ParseException:System.Exception
+ {
+ /// <summary> This method has the standard behavior when this object has been
+ /// created using the standard constructors. Otherwise, it uses
+ /// "currentToken" and "expectedTokenSequences" to generate a parse
+ /// error message and returns it. If this object has been created
+ /// due to a parse error, and you do not catch it (it gets thrown
+ /// from the parser), then this method is called during the printing
+ /// of the final stack trace, and hence the correct error message
+ /// gets displayed.
+ /// </summary>
+ public override System.String Message
+ {
+ get
+ {
+ if (!specialConstructor)
+ {
+ return base.Message;
+ }
+ System.String expected = "";
+ int maxSize = 0;
+ for (int i = 0; i < expectedTokenSequences.Length; i++)
+ {
+ if (maxSize < expectedTokenSequences[i].Length)
+ {
+ maxSize = expectedTokenSequences[i].Length;
+ }
+ for (int j = 0; j < expectedTokenSequences[i].Length; j++)
+ {
+ expected += (tokenImage[expectedTokenSequences[i][j]] + " ");
+ }
+ if (expectedTokenSequences[i][expectedTokenSequences[i].Length - 1] != 0)
+ {
+ expected += "...";
+ }
+ expected += (eol + " ");
+ }
+ System.String retval = "Encountered \"";
+ Token tok = currentToken.next;
+ for (int i = 0; i < maxSize; i++)
+ {
+ if (i != 0)
+ retval += " ";
+ if (tok.kind == 0)
+ {
+ retval += tokenImage[0];
+ break;
+ }
+ retval += Add_escapes(tok.image);
+ tok = tok.next;
+ }
+ retval += ("\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn);
+ retval += ("." + eol);
+ if (expectedTokenSequences.Length == 1)
+ {
+ retval += ("Was expecting:" + eol + " ");
+ }
+ else
+ {
+ retval += ("Was expecting one of:" + eol + " ");
+ }
+ retval += expected;
+ return retval;
+ }
- }
+ }
- /// <summary> This constructor is used by the method "generateParseException"
- /// in the generated parser. Calling this constructor generates
- /// a new object of this type with the fields "currentToken",
- /// "expectedTokenSequences", and "tokenImage" set. The boolean
- /// flag "specialConstructor" is also set to true to indicate that
- /// this constructor was used to create this object.
- /// This constructor calls its super class with the empty string
- /// to force the "toString" method of parent class "Throwable" to
- /// print the error message in the form:
- /// ParseException: <result of getMessage>
- /// </summary>
- public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, System.String[] tokenImageVal):base("")
- {
- specialConstructor = true;
- currentToken = currentTokenVal;
- expectedTokenSequences = expectedTokenSequencesVal;
- tokenImage = tokenImageVal;
- }
-
- /// <summary> The following constructors are for use by you for whatever
- /// purpose you can think of. Constructing the exception in this
- /// manner makes the exception behave in the normal way - i.e., as
- /// documented in the class "Throwable". The fields "errorToken",
- /// "expectedTokenSequences", and "tokenImage" do not contain
- /// relevant information. The JavaCC generated code does not use
- /// these constructors.
- /// </summary>
-
- public ParseException():base()
- {
- specialConstructor = false;
- }
-
- public ParseException(System.String message):base(message)
- {
- specialConstructor = false;
- }
-
- /// <summary> This variable determines which constructor was used to create
- /// this object and thereby affects the semantics of the
- /// "getMessage" method (see below).
- /// </summary>
- protected internal bool specialConstructor;
-
- /// <summary> This is the last token that has been consumed successfully. If
- /// this object has been created due to a parse error, the token
- /// followng this token will (therefore) be the first error token.
- /// </summary>
- public Token currentToken;
-
- /// <summary> Each entry in this array is an array of integers. Each array
- /// of integers represents a sequence of tokens (by their ordinal
- /// values) that is expected at this point of the parse.
- /// </summary>
- public int[][] expectedTokenSequences;
-
- /// <summary> This is a reference to the "tokenImage" array of the generated
- /// parser within which the parse error occurred. This array is
- /// defined in the generated ...Constants interface.
- /// </summary>
- public System.String[] tokenImage;
-
- /// <summary> The end of line string for this machine.</summary>
- protected internal System.String eol = SupportClass.AppSettings.Get("line.separator", "\n");
-
- /// <summary> Used to convert raw characters to their escaped version
- /// when these raw version cannot be used as part of an ASCII
- /// string literal.
- /// </summary>
- protected internal virtual System.String Add_Escapes(System.String str)
- {
- System.Text.StringBuilder retval = new System.Text.StringBuilder();
- char ch;
- for (int i = 0; i < str.Length; i++)
- {
- switch (str[i])
- {
-
- case (char) (0):
- continue;
-
- case '\b':
- retval.Append("\\b");
- continue;
-
- case '\t':
- retval.Append("\\t");
- continue;
-
- case '\n':
- retval.Append("\\n");
- continue;
-
- case '\f':
- retval.Append("\\f");
- continue;
-
- case '\r':
- retval.Append("\\r");
- continue;
-
- case '\"':
- retval.Append("\\\"");
- continue;
-
- case '\'':
- retval.Append("\\\'");
- continue;
-
- case '\\':
- retval.Append("\\\\");
- continue;
-
- default:
- if ((ch = str[i]) < 0x20 || ch > 0x7e)
- {
- System.String s = "0000" + System.Convert.ToString(ch, 16);
- retval.Append("\\u" + s.Substring(s.Length - 4, (s.Length) - (s.Length - 4)));
- }
- else
- {
- retval.Append(ch);
- }
- continue;
-
- }
- }
- return retval.ToString();
- }
- }
+ /// <summary> This constructor is used by the method "generateParseException"
+ /// in the generated parser. Calling this constructor generates
+ /// a new object of this type with the fields "currentToken",
+ /// "expectedTokenSequences", and "tokenImage" set. The boolean
+ /// flag "specialConstructor" is also set to true to indicate that
+ /// this constructor was used to create this object.
+ /// This constructor calls its super class with the empty string
+ /// to force the "toString" method of parent class "Throwable" to
+ /// print the error message in the form:
+ /// ParseException: <result of getMessage>
+ /// </summary>
+ public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, System.String[] tokenImageVal) : base("")
+ {
+ specialConstructor = true;
+ currentToken = currentTokenVal;
+ expectedTokenSequences = expectedTokenSequencesVal;
+ tokenImage = tokenImageVal;
+ }
+
+ /// <summary> The following constructors are for use by you for whatever
+ /// purpose you can think of. Constructing the exception in this
+ /// manner makes the exception behave in the normal way - i.e., as
+ /// documented in the class "Throwable". The fields "errorToken",
+ /// "expectedTokenSequences", and "tokenImage" do not contain
+ /// relevant information. The JavaCC generated code does not use
+ /// these constructors.
+ /// </summary>
+
+ public ParseException():base()
+ {
+ specialConstructor = false;
+ }
+
+ public ParseException(System.String message) : base(message)
+ {
+ specialConstructor = false;
+ }
+
+ /// <summary> This variable determines which constructor was used to create
+ /// this object and thereby affects the semantics of the
+ /// "getMessage" method (see below).
+ /// </summary>
+ protected internal bool specialConstructor;
+
+ /// <summary> This is the last token that has been consumed successfully. If
+ /// this object has been created due to a parse error, the token
+ /// followng this token will (therefore) be the first error token.
+ /// </summary>
+ public Token currentToken;
+
+ /// <summary> Each entry in this array is an array of integers. Each array
+ /// of integers represents a sequence of tokens (by their ordinal
+ /// values) that is expected at this point of the parse.
+ /// </summary>
+ public int[][] expectedTokenSequences;
+
+ /// <summary> This is a reference to the "tokenImage" array of the generated
+ /// parser within which the parse error occurred. This array is
+ /// defined in the generated ...Constants interface.
+ /// </summary>
+ public System.String[] tokenImage;
+
+ /// <summary> The end of line string for this machine.</summary>
+ protected internal System.String eol = SupportClass.AppSettings.Get("line.separator", "\n");
+
+ /// <summary> Used to convert raw characters to their escaped version
+ /// when these raw version cannot be used as part of an ASCII
+ /// string literal.
+ /// </summary>
+ protected internal virtual System.String Add_escapes(System.String str)
+ {
+ System.Text.StringBuilder retval = new System.Text.StringBuilder();
+ char ch;
+ for (int i = 0; i < str.Length; i++)
+ {
+ switch (str[i])
+ {
+
+ case (char) (0):
+ continue;
+
+ case '\b':
+ retval.Append("\\b");
+ continue;
+
+ case '\t':
+ retval.Append("\\t");
+ continue;
+
+ case '\n':
+ retval.Append("\\n");
+ continue;
+
+ case '\f':
+ retval.Append("\\f");
+ continue;
+
+ case '\r':
+ retval.Append("\\r");
+ continue;
+
+ case '\"':
+ retval.Append("\\\"");
+ continue;
+
+ case '\'':
+ retval.Append("\\\'");
+ continue;
+
+ case '\\':
+ retval.Append("\\\\");
+ continue;
+
+ default:
+ if ((ch = str[i]) < 0x20 || ch > 0x7e)
+ {
+ System.String s = "0000" + System.Convert.ToString(ch, 16);
+ retval.Append("\\u" + s.Substring(s.Length - 4, (s.Length) - (s.Length - 4)));
+ }
+ else
+ {
+ retval.Append(ch);
+ }
+ continue;
+
+ }
+ }
+ return retval.ToString();
+ }
+ }
}
Modified: incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/ParserThread.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/DemoLib/HTML/ParserThread.cs?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/ParserThread.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/ParserThread.cs Sat Jun 3 19:41:13 2006
@@ -13,53 +13,54 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
using System;
+
namespace Lucene.Net.Demo.Html
{
- class ParserThread:SupportClass.ThreadClass
- {
- internal HTMLParser parser;
+ class ParserThread:SupportClass.ThreadClass
+ {
+ internal HTMLParser parser;
- internal ParserThread(HTMLParser p)
- {
- parser = p;
- }
+ internal ParserThread(HTMLParser p)
+ {
+ parser = p;
+ }
- override public void Run()
- {
- // convert pipeOut to pipeIn
- try
- {
- try
- {
- // parse document to pipeOut
- parser.HTMLDocument();
- }
- catch (ParseException e)
- {
- System.Console.Out.WriteLine("Parse Aborted: " + e.Message);
- }
- catch (TokenMgrError e)
- {
- System.Console.Out.WriteLine("Parse Aborted: " + e.Message);
- }
- finally
- {
- //parser.pipeOut.Close();
- lock (parser)
- {
- parser.summary.Length = Lucene.Net.Demo.Html.HTMLParser.SUMMARY_LENGTH;
- parser.summaryComplete = true;
- parser.titleComplete = true;
- System.Threading.Monitor.PulseAll(parser);
- }
- }
- }
- catch (System.IO.IOException e)
- {
- System.Console.Error.WriteLine(e.StackTrace);
- }
- }
- }
+ override public void Run()
+ {
+ // convert pipeOut to pipeIn
+ try
+ {
+ try
+ {
+ // parse document to pipeOut
+ parser.HTMLDocument();
+ }
+ catch (ParseException e)
+ {
+ System.Console.Out.WriteLine("Parse Aborted: " + e.Message);
+ }
+ catch (TokenMgrError e)
+ {
+ System.Console.Out.WriteLine("Parse Aborted: " + e.Message);
+ }
+ finally
+ {
+ parser.pipeOut.Close();
+ lock (parser)
+ {
+ parser.summary.Length = HTMLParser.SUMMARY_LENGTH;
+ parser.titleComplete = true;
+ System.Threading.Monitor.PulseAll(parser);
+ }
+ }
+ }
+ catch (System.IO.IOException e)
+ {
+ System.Console.Error.WriteLine(e.StackTrace);
+ }
+ }
+ }
}
Modified: incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/SimpleCharStream.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/DemoLib/HTML/SimpleCharStream.cs?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/SimpleCharStream.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/SimpleCharStream.cs Sat Jun 3 19:41:13 2006
@@ -15,407 +15,401 @@
*/
/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 3.0 */
+
using System;
+
namespace Lucene.Net.Demo.Html
{
- /// <summary> An implementation of interface CharStream, where the stream is assumed to
- /// contain only ASCII characters (without unicode processing).
- /// </summary>
+ /// <summary> An implementation of interface CharStream, where the stream is assumed to
+ /// contain only ASCII characters (without unicode processing).
+ /// </summary>
- public class SimpleCharStream
- {
- public const bool staticFlag = false;
- internal int bufsize;
- internal int available;
- internal int tokenBegin;
- public int bufpos = -1;
- protected internal int[] bufline;
- protected internal int[] bufcolumn;
-
- protected internal int column = 0;
- protected internal int line = 1;
-
- protected internal bool prevCharIsCR = false;
- protected internal bool prevCharIsLF = false;
-
- protected internal System.IO.StreamReader inputStream;
-
- protected internal char[] buffer;
- protected internal int maxNextCharInd = 0;
- protected internal int inBuf = 0;
-
- protected internal virtual void ExpandBuff(bool wrapAround)
- {
- char[] newbuffer = new char[bufsize + 2048];
- int[] newbufline = new int[bufsize + 2048];
- int[] newbufcolumn = new int[bufsize + 2048];
-
- try
- {
- if (wrapAround)
- {
- Array.Copy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- Array.Copy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos);
- buffer = newbuffer;
+ public class SimpleCharStream
+ {
+ public const bool staticFlag = false;
+ internal int bufsize;
+ internal int available;
+ internal int tokenBegin;
+ public int bufpos = - 1;
+ protected internal int[] bufline;
+ protected internal int[] bufcolumn;
+
+ protected internal int column = 0;
+ protected internal int line = 1;
+
+ protected internal bool prevCharIsCR = false;
+ protected internal bool prevCharIsLF = false;
+
+ protected internal System.IO.StreamReader inputStream;
+
+ protected internal char[] buffer;
+ protected internal int maxNextCharInd = 0;
+ protected internal int inBuf = 0;
+
+ protected internal virtual void ExpandBuff(bool wrapAround)
+ {
+ char[] newbuffer = new char[bufsize + 2048];
+ int[] newbufline = new int[bufsize + 2048];
+ int[] newbufcolumn = new int[bufsize + 2048];
+
+ try
+ {
+ if (wrapAround)
+ {
+ Array.Copy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ Array.Copy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos);
+ buffer = newbuffer;
- Array.Copy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
- Array.Copy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
- bufline = newbufline;
+ Array.Copy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ Array.Copy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
+ bufline = newbufline;
- Array.Copy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
- Array.Copy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
- bufcolumn = newbufcolumn;
+ Array.Copy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ Array.Copy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
+ bufcolumn = newbufcolumn;
- maxNextCharInd = (bufpos += (bufsize - tokenBegin));
- }
- else
- {
- Array.Copy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- buffer = newbuffer;
+ maxNextCharInd = (bufpos += (bufsize - tokenBegin));
+ }
+ else
+ {
+ Array.Copy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ buffer = newbuffer;
- Array.Copy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
- bufline = newbufline;
+ Array.Copy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ bufline = newbufline;
- Array.Copy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
- bufcolumn = newbufcolumn;
+ Array.Copy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ bufcolumn = newbufcolumn;
- maxNextCharInd = (bufpos -= tokenBegin);
- }
- }
- catch (System.Exception t)
- {
- throw new System.ApplicationException(t.Message);
- }
-
-
- bufsize += 2048;
- available = bufsize;
- tokenBegin = 0;
- }
-
- protected internal virtual void FillBuff()
- {
- if (maxNextCharInd == available)
- {
- if (available == bufsize)
- {
- if (tokenBegin > 2048)
- {
- bufpos = maxNextCharInd = 0;
- available = tokenBegin;
- }
- else if (tokenBegin < 0)
- bufpos = maxNextCharInd = 0;
- else
- ExpandBuff(false);
- }
- else if (available > tokenBegin)
- available = bufsize;
- else if ((tokenBegin - available) < 2048)
- ExpandBuff(true);
- else
- available = tokenBegin;
- }
-
- int i = 0;
- try
- {
- try
- {
- i = inputStream.Read(buffer, maxNextCharInd, available - maxNextCharInd);
- }
- catch
- {
- }
-
- if (i == 0)
- {
- inputStream.Close();
- throw new System.IO.IOException();
- }
- else
- maxNextCharInd += i;
- return ;
- }
- catch (System.IO.IOException e)
- {
- --bufpos;
- Backup(0);
- if (tokenBegin == -1)
- tokenBegin = bufpos;
- throw e;
- }
- }
-
- public virtual char BeginToken()
- {
- tokenBegin = - 1;
- char c = ReadChar();
- tokenBegin = bufpos;
-
- return c;
- }
-
- protected internal virtual void UpdateLineColumn(char c)
- {
- column++;
-
- if (prevCharIsLF)
- {
- prevCharIsLF = false;
- line += (column = 1);
- }
- else if (prevCharIsCR)
- {
- prevCharIsCR = false;
- if (c == '\n')
- {
- prevCharIsLF = true;
- }
- else
- line += (column = 1);
- }
+ maxNextCharInd = (bufpos -= tokenBegin);
+ }
+ }
+ catch (System.Exception t)
+ {
+ throw new System.ApplicationException(t.Message);
+ }
+
+
+ bufsize += 2048;
+ available = bufsize;
+ tokenBegin = 0;
+ }
+
+ protected internal virtual void FillBuff()
+ {
+ if (maxNextCharInd == available)
+ {
+ if (available == bufsize)
+ {
+ if (tokenBegin > 2048)
+ {
+ bufpos = maxNextCharInd = 0;
+ available = tokenBegin;
+ }
+ else if (tokenBegin < 0)
+ bufpos = maxNextCharInd = 0;
+ else
+ ExpandBuff(false);
+ }
+ else if (available > tokenBegin)
+ available = bufsize;
+ else if ((tokenBegin - available) < 2048)
+ ExpandBuff(true);
+ else
+ available = tokenBegin;
+ }
+
+ int i;
+ try
+ {
+ if ((i = inputStream.Read(buffer, maxNextCharInd, available - maxNextCharInd)) == - 1)
+ {
+ inputStream.Close();
+ throw new System.IO.IOException();
+ }
+ else
+ maxNextCharInd += i;
+ return ;
+ }
+ catch (System.IO.IOException e)
+ {
+ --bufpos;
+ Backup(0);
+ if (tokenBegin == - 1)
+ tokenBegin = bufpos;
+ throw e;
+ }
+ }
+
+ public virtual char BeginToken()
+ {
+ tokenBegin = - 1;
+ char c = ReadChar();
+ tokenBegin = bufpos;
+
+ return c;
+ }
+
+ protected internal virtual void UpdateLineColumn(char c)
+ {
+ column++;
+
+ if (prevCharIsLF)
+ {
+ prevCharIsLF = false;
+ line += (column = 1);
+ }
+ else if (prevCharIsCR)
+ {
+ prevCharIsCR = false;
+ if (c == '\n')
+ {
+ prevCharIsLF = true;
+ }
+ else
+ line += (column = 1);
+ }
- switch (c)
- {
+ switch (c)
+ {
- case '\r':
- prevCharIsCR = true;
- break;
+ case '\r':
+ prevCharIsCR = true;
+ break;
- case '\n':
- prevCharIsLF = true;
- break;
+ case '\n':
+ prevCharIsLF = true;
+ break;
- case '\t':
- column--;
- column += (8 - (column & 7));
- break;
+ case '\t':
+ column--;
+ column += (8 - (column & 7));
+ break;
- default:
- break;
+ default:
+ break;
- }
+ }
- bufline[bufpos] = line;
- bufcolumn[bufpos] = column;
- }
-
- public virtual char ReadChar()
- {
- if (inBuf > 0)
- {
- --inBuf;
+ bufline[bufpos] = line;
+ bufcolumn[bufpos] = column;
+ }
+
+ public virtual char ReadChar()
+ {
+ if (inBuf > 0)
+ {
+ --inBuf;
- if (++bufpos == bufsize)
- bufpos = 0;
+ if (++bufpos == bufsize)
+ bufpos = 0;
- return buffer[bufpos];
- }
+ return buffer[bufpos];
+ }
- if (++bufpos >= maxNextCharInd)
- FillBuff();
+ if (++bufpos >= maxNextCharInd)
+ FillBuff();
- char c = buffer[bufpos];
+ char c = buffer[bufpos];
- UpdateLineColumn(c);
- return (c);
- }
-
- /// <deprecated>
- /// </deprecated>
- /// <seealso cref="#getEndColumn">
- /// </seealso>
-
- public virtual int GetColumn()
- {
- return bufcolumn[bufpos];
- }
-
- /// <deprecated>
- /// </deprecated>
- /// <seealso cref="#getEndLine">
- /// </seealso>
-
- public virtual int GetLine()
- {
- return bufline[bufpos];
- }
-
- public virtual int GetEndColumn()
- {
- return bufcolumn[bufpos];
- }
-
- public virtual int GetEndLine()
- {
- return bufline[bufpos];
- }
-
- public virtual int GetBeginColumn()
- {
- return bufcolumn[tokenBegin];
- }
-
- public virtual int GetBeginLine()
- {
- return bufline[tokenBegin];
- }
-
- public virtual void Backup(int amount)
- {
-
- inBuf += amount;
- if ((bufpos -= amount) < 0)
- bufpos += bufsize;
- }
-
- public SimpleCharStream(System.IO.StreamReader dstream, int startline, int startcolumn, int buffersize)
- {
- inputStream = dstream;
- line = startline;
- column = startcolumn - 1;
-
- available = bufsize = buffersize;
- buffer = new char[buffersize];
- bufline = new int[buffersize];
- bufcolumn = new int[buffersize];
- }
-
- public SimpleCharStream(System.IO.StreamReader dstream, int startline, int startcolumn):this(dstream, startline, startcolumn, 4096)
- {
- }
-
- public SimpleCharStream(System.IO.StreamReader dstream):this(dstream, 1, 1, 4096)
- {
- }
+ UpdateLineColumn(c);
+ return (c);
+ }
+
+ /// <deprecated>
+ /// </deprecated>
+ /// <seealso cref="getEndColumn">
+ /// </seealso>
+
+ public virtual int GetColumn()
+ {
+ return bufcolumn[bufpos];
+ }
+
+ /// <deprecated>
+ /// </deprecated>
+ /// <seealso cref="getEndLine">
+ /// </seealso>
+
+ public virtual int GetLine()
+ {
+ return bufline[bufpos];
+ }
+
+ public virtual int GetEndColumn()
+ {
+ return bufcolumn[bufpos];
+ }
+
+ public virtual int GetEndLine()
+ {
+ return bufline[bufpos];
+ }
+
+ public virtual int GetBeginColumn()
+ {
+ return bufcolumn[tokenBegin];
+ }
+
+ public virtual int GetBeginLine()
+ {
+ return bufline[tokenBegin];
+ }
+
+ public virtual void Backup(int amount)
+ {
+
+ inBuf += amount;
+ if ((bufpos -= amount) < 0)
+ bufpos += bufsize;
+ }
+
+ public SimpleCharStream(System.IO.StreamReader dstream, int startline, int startcolumn, int buffersize)
+ {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ }
+
+ public SimpleCharStream(System.IO.StreamReader dstream, int startline, int startcolumn) : this(dstream, startline, startcolumn, 4096)
+ {
+ }
+
+ public SimpleCharStream(System.IO.StreamReader dstream):this(dstream, 1, 1, 4096)
+ {
+ }
public virtual void ReInit(System.IO.StreamReader dstream, int startline, int startcolumn, int buffersize)
- {
- inputStream = dstream;
- line = startline;
- column = startcolumn - 1;
-
- if (buffer == null || buffersize != buffer.Length)
- {
- available = bufsize = buffersize;
- buffer = new char[buffersize];
- bufline = new int[buffersize];
- bufcolumn = new int[buffersize];
- }
- prevCharIsLF = prevCharIsCR = false;
- tokenBegin = inBuf = maxNextCharInd = 0;
- bufpos = - 1;
- }
-
- public virtual void ReInit(System.IO.StreamReader dstream, int startline, int startcolumn)
- {
- ReInit(dstream, startline, startcolumn, 4096);
- }
-
- public virtual void ReInit(System.IO.StreamReader dstream)
- {
- ReInit(dstream, 1, 1, 4096);
- }
- public SimpleCharStream(System.IO.Stream dstream, int startline, int startcolumn, int buffersize) : this(new System.IO.StreamReader(dstream, System.Text.Encoding.Default), startline, startcolumn, 4096)
- {
- }
-
- public SimpleCharStream(System.IO.Stream dstream, int startline, int startcolumn) : this(dstream, startline, startcolumn, 4096)
- {
- }
-
- public SimpleCharStream(System.IO.Stream dstream):this(dstream, 1, 1, 4096)
- {
- }
-
- public virtual void ReInit(System.IO.Stream dstream, int startline, int startcolumn, int buffersize)
- {
- ReInit(new System.IO.StreamReader(dstream, System.Text.Encoding.Default), startline, startcolumn, 4096);
- }
-
- public virtual void ReInit(System.IO.Stream dstream)
- {
- ReInit(dstream, 1, 1, 4096);
- }
- public virtual void ReInit(System.IO.Stream dstream, int startline, int startcolumn)
- {
- ReInit(dstream, startline, startcolumn, 4096);
- }
- public virtual System.String GetImage()
- {
- if (bufpos >= tokenBegin)
- return new System.String(buffer, tokenBegin, bufpos - tokenBegin + 1);
- else
- return new System.String(buffer, tokenBegin, bufsize - tokenBegin) + new System.String(buffer, 0, bufpos + 1);
- }
-
- public virtual char[] GetSuffix(int len)
- {
- char[] ret = new char[len];
-
- if ((bufpos + 1) >= len)
- Array.Copy(buffer, bufpos - len + 1, ret, 0, len);
- else
- {
- Array.Copy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1);
- Array.Copy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
- }
-
- return ret;
- }
-
- public virtual void Done()
- {
- buffer = null;
- bufline = null;
- bufcolumn = null;
- }
-
- /// <summary> Method to adjust line and column numbers for the start of a token.</summary>
- public virtual void AdjustBeginLineColumn(int newLine, int newCol)
- {
- int start = tokenBegin;
- int len;
-
- if (bufpos >= tokenBegin)
- {
- len = bufpos - tokenBegin + inBuf + 1;
- }
- else
- {
- len = bufsize - tokenBegin + bufpos + 1 + inBuf;
- }
-
- int i = 0, j = 0, k = 0;
- int nextColDiff = 0, columnDiff = 0;
-
- while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
- {
- bufline[j] = newLine;
- nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
- bufcolumn[j] = newCol + columnDiff;
- columnDiff = nextColDiff;
- i++;
- }
-
- if (i < len)
- {
- bufline[j] = newLine++;
- bufcolumn[j] = newCol + columnDiff;
+ {
+ inputStream = dstream;
+ line = startline;
+ column = startcolumn - 1;
+
+ if (buffer == null || buffersize != buffer.Length)
+ {
+ available = bufsize = buffersize;
+ buffer = new char[buffersize];
+ bufline = new int[buffersize];
+ bufcolumn = new int[buffersize];
+ }
+ prevCharIsLF = prevCharIsCR = false;
+ tokenBegin = inBuf = maxNextCharInd = 0;
+ bufpos = - 1;
+ }
+
+ public virtual void ReInit(System.IO.StreamReader dstream, int startline, int startcolumn)
+ {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+
+ public virtual void ReInit(System.IO.StreamReader dstream)
+ {
+ ReInit(dstream, 1, 1, 4096);
+ }
+ public SimpleCharStream(System.IO.Stream dstream, int startline, int startcolumn, int buffersize) : this(new System.IO.StreamReader(dstream, System.Text.Encoding.Default), startline, startcolumn, 4096)
+ {
+ }
+
+ public SimpleCharStream(System.IO.Stream dstream, int startline, int startcolumn) : this(dstream, startline, startcolumn, 4096)
+ {
+ }
+
+ public SimpleCharStream(System.IO.Stream dstream) : this(dstream, 1, 1, 4096)
+ {
+ }
+
+ public virtual void ReInit(System.IO.Stream dstream, int startline, int startcolumn, int buffersize)
+ {
+ ReInit(new System.IO.StreamReader(dstream, System.Text.Encoding.Default), startline, startcolumn, 4096);
+ }
+
+ public virtual void ReInit(System.IO.Stream dstream)
+ {
+ ReInit(dstream, 1, 1, 4096);
+ }
+ public virtual void ReInit(System.IO.Stream dstream, int startline, int startcolumn)
+ {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+ public virtual System.String GetImage()
+ {
+ if (bufpos >= tokenBegin)
+ return new System.String(buffer, tokenBegin, bufpos - tokenBegin + 1);
+ else
+ return new System.String(buffer, tokenBegin, bufsize - tokenBegin) + new System.String(buffer, 0, bufpos + 1);
+ }
+
+ public virtual char[] GetSuffix(int len)
+ {
+ char[] ret = new char[len];
+
+ if ((bufpos + 1) >= len)
+ Array.Copy(buffer, bufpos - len + 1, ret, 0, len);
+ else
+ {
+ Array.Copy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1);
+ Array.Copy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
+ }
+
+ return ret;
+ }
+
+ public virtual void Done()
+ {
+ buffer = null;
+ bufline = null;
+ bufcolumn = null;
+ }
+
+ /// <summary> Method to adjust line and column numbers for the start of a token.</summary>
+ public virtual void AdjustBeginLineColumn(int newLine, int newCol)
+ {
+ int start = tokenBegin;
+ int len;
+
+ if (bufpos >= tokenBegin)
+ {
+ len = bufpos - tokenBegin + inBuf + 1;
+ }
+ else
+ {
+ len = bufsize - tokenBegin + bufpos + 1 + inBuf;
+ }
+
+ int i = 0, j = 0, k = 0;
+ int nextColDiff = 0, columnDiff = 0;
+
+ while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
+ {
+ bufline[j] = newLine;
+ nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
+ bufcolumn[j] = newCol + columnDiff;
+ columnDiff = nextColDiff;
+ i++;
+ }
+
+ if (i < len)
+ {
+ bufline[j] = newLine++;
+ bufcolumn[j] = newCol + columnDiff;
- while (i++ < len)
- {
- if (bufline[j = start % bufsize] != bufline[++start % bufsize])
- bufline[j] = newLine++;
- else
- bufline[j] = newLine;
- }
- }
-
- line = bufline[j];
- column = bufcolumn[j];
- }
- }
+ while (i++ < len)
+ {
+ if (bufline[j = start % bufsize] != bufline[++start % bufsize])
+ bufline[j] = newLine++;
+ else
+ bufline[j] = newLine;
+ }
+ }
+
+ line = bufline[j];
+ column = bufcolumn[j];
+ }
+ }
}
Modified: incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/Tags.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/DemoLib/HTML/Tags.cs?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/Tags.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/Tags.cs Sat Jun 3 19:41:13 2006
@@ -13,20 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
using System;
+
namespace Lucene.Net.Demo.Html
{
- public sealed class Tags
- {
+ public sealed class Tags
+ {
- /// <summary> contains all tags for which whitespaces have to be inserted for proper tokenization</summary>
+ /// <summary> contains all tags for which whitespaces have to be inserted for proper tokenization</summary>
public static readonly System.Collections.Hashtable WS_ELEMS = new System.Collections.Hashtable();
- //public static readonly SupportClass.SetSupport WS_ELEMS = (SupportClass.SetSupport) new SupportClass.HashSetSupport(SupportClass.HashSetSupport.Synchronized(new SupportClass.HashSetSupport(new SupportClass.HashSetSupport())));
static Tags()
- {
- {
+ {
+ {
WS_ELEMS.Add("<hr", "<hr");
WS_ELEMS.Add("<hr/", "<hr/"); // note that "<hr />" does not need to be listed explicitly
WS_ELEMS.Add("<br", "<br");
@@ -58,6 +59,6 @@
WS_ELEMS.Add("<h6", "<h6");
WS_ELEMS.Add("</h6", "</h6");
}
- }
- }
+ }
+ }
}
Modified: incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/Test.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/DemoLib/HTML/Test.cs?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/Test.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/Test.cs Sat Jun 3 19:41:13 2006
@@ -13,38 +13,51 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
using System;
+
namespace Lucene.Net.Demo.Html
{
- class Test
- {
- [STAThread]
- public static void Main(System.String[] argv)
- {
- if ("-dir".Equals(argv[0]))
- {
- System.String[] files = System.IO.Directory.GetFileSystemEntries(new System.IO.FileInfo(argv[1]).FullName);
- System.Array.Sort(files);
- for (int i = 0; i < files.Length; i++)
- {
- System.Console.Error.WriteLine(files[i]);
- System.IO.FileInfo file = new System.IO.FileInfo(argv[1] + "\\" + files[i]);
- Parse(file);
- }
- }
- else
- Parse(new System.IO.FileInfo(argv[0]));
- }
+ class Test
+ {
+ [STAThread]
+ public static void Main(System.String[] argv)
+ {
+ if ("-dir".Equals(argv[0]))
+ {
+ System.String[] files = System.IO.Directory.GetFileSystemEntries(new System.IO.FileInfo(argv[1]).FullName);
+ System.Array.Sort(files);
+ for (int i = 0; i < files.Length; i++)
+ {
+ System.Console.Error.WriteLine(files[i]);
+ System.IO.FileInfo file = new System.IO.FileInfo(argv[1] + "\\" + files[i]);
+ Parse(file);
+ }
+ }
+ else
+ Parse(new System.IO.FileInfo(argv[0]));
+ }
- public static void Parse(System.IO.FileInfo file)
- {
- HTMLParser parser = new HTMLParser(file);
- System.Console.Out.WriteLine("Title: " + Entities.Encode(parser.GetTitle()));
- System.Console.Out.WriteLine("Summary: " + Entities.Encode(parser.GetSummary()));
- System.IO.StreamReader reader = new System.IO.StreamReader(parser.GetReader().BaseStream, parser.GetReader().CurrentEncoding);
- for (System.String l = reader.ReadLine(); l != null; l = reader.ReadLine())
- System.Console.Out.WriteLine(l);
- }
- }
+ public static void Parse(System.IO.FileInfo file)
+ {
+ System.IO.FileStream fis = null;
+ try
+ {
+ fis = new System.IO.FileStream(file.FullName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
+ HTMLParser parser = new HTMLParser(fis);
+ System.Console.Out.WriteLine("Title: " + Entities.Encode(parser.GetTitle()));
+ System.Console.Out.WriteLine("Summary: " + Entities.Encode(parser.GetSummary()));
+ System.Console.Out.WriteLine("Content:");
+ System.IO.StreamReader reader = new System.IO.StreamReader(parser.GetReader().BaseStream, parser.GetReader().CurrentEncoding);
+ for (System.String l = reader.ReadLine(); l != null; l = reader.ReadLine())
+ System.Console.Out.WriteLine(l);
+ }
+ finally
+ {
+ if (fis != null)
+ fis.Close();
+ }
+ }
+ }
}
Modified: incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/Token.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/DemoLib/HTML/Token.cs?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/Token.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/Token.cs Sat Jun 3 19:41:13 2006
@@ -15,77 +15,79 @@
*/
/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
+
using System;
+
namespace Lucene.Net.Demo.Html
{
- /// <summary> Describes the input token stream.</summary>
+ /// <summary> Describes the input token stream.</summary>
- public class Token
- {
+ public class Token
+ {
- /// <summary> An integer that describes the kind of this token. This numbering
- /// system is determined by JavaCCParser, and a table of these numbers is
- /// stored in the file ...Constants.java.
- /// </summary>
- public int kind;
-
- /// <summary> beginLine and beginColumn describe the position of the first character
- /// of this token; endLine and endColumn describe the position of the
- /// last character of this token.
- /// </summary>
- public int beginLine, beginColumn, endLine, endColumn;
-
- /// <summary> The string image of the token.</summary>
- public System.String image;
-
- /// <summary> A reference to the next regular (non-special) token from the input
- /// stream. If this is the last token from the input stream, or if the
- /// token manager has not read tokens beyond this one, this field is
- /// set to null. This is true only if this token is also a regular
- /// token. Otherwise, see below for a description of the contents of
- /// this field.
- /// </summary>
- public Token next;
-
- /// <summary> This field is used to access special tokens that occur prior to this
- /// token, but after the immediately preceding regular (non-special) token.
- /// If there are no such special tokens, this field is set to null.
- /// When there are more than one such special token, this field refers
- /// to the last of these special tokens, which in turn refers to the next
- /// previous special token through its specialToken field, and so on
- /// until the first special token (whose specialToken field is null).
- /// The next fields of special tokens refer to other special tokens that
- /// immediately follow it (without an intervening regular token). If there
- /// is no such token, this field is null.
- /// </summary>
- public Token specialToken;
-
- /// <summary> Returns the image.</summary>
- public override System.String ToString()
- {
- return image;
- }
-
- /// <summary> Returns a new Token object, by default. However, if you want, you
- /// can create and return subclass objects based on the value of ofKind.
- /// Simply add the cases to the switch for all those special cases.
- /// For example, if you have a subclass of Token called IDToken that
- /// you want to create if ofKind is ID, simlpy add something like :
- ///
- /// case MyParserConstants.ID : return new IDToken();
- ///
- /// to the following switch statement. Then you can cast matchedToken
- /// variable to the appropriate type and use it in your lexical actions.
- /// </summary>
- public static Token newToken(int ofKind)
- {
- switch (ofKind)
- {
+ /// <summary> An integer that describes the kind of this token. This numbering
+ /// system is determined by JavaCCParser, and a table of these numbers is
+ /// stored in the file ...Constants.java.
+ /// </summary>
+ public int kind;
+
+ /// <summary> beginLine and beginColumn describe the position of the first character
+ /// of this token; endLine and endColumn describe the position of the
+ /// last character of this token.
+ /// </summary>
+ public int beginLine, beginColumn, endLine, endColumn;
+
+ /// <summary> The string image of the token.</summary>
+ public System.String image;
+
+ /// <summary> A reference to the next regular (non-special) token from the input
+ /// stream. If this is the last token from the input stream, or if the
+ /// token manager has not read tokens beyond this one, this field is
+ /// set to null. This is true only if this token is also a regular
+ /// token. Otherwise, see below for a description of the contents of
+ /// this field.
+ /// </summary>
+ public Token next;
+
+ /// <summary> This field is used to access special tokens that occur prior to this
+ /// token, but after the immediately preceding regular (non-special) token.
+ /// If there are no such special tokens, this field is set to null.
+ /// When there are more than one such special token, this field refers
+ /// to the last of these special tokens, which in turn refers to the next
+ /// previous special token through its specialToken field, and so on
+ /// until the first special token (whose specialToken field is null).
+ /// The next fields of special tokens refer to other special tokens that
+ /// immediately follow it (without an intervening regular token). If there
+ /// is no such token, this field is null.
+ /// </summary>
+ public Token specialToken;
+
+ /// <summary> Returns the image.</summary>
+ public override System.String ToString()
+ {
+ return image;
+ }
+
+ /// <summary> Returns a new Token object, by default. However, if you want, you
+ /// can create and return subclass objects based on the value of ofKind.
+ /// Simply add the cases to the switch for all those special cases.
+ /// For example, if you have a subclass of Token called IDToken that
+ /// you want to create if ofKind is ID, simlpy add something like :
+ ///
+ /// case MyParserConstants.ID : return new IDToken();
+ ///
+ /// to the following switch statement. Then you can cast matchedToken
+ /// variable to the appropriate type and use it in your lexical actions.
+ /// </summary>
+ public static Token newToken(int ofKind)
+ {
+ switch (ofKind)
+ {
- default: return new Token();
+ default: return new Token();
- }
- }
- }
+ }
+ }
+ }
}
Modified: incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/TokenMgrError.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/DemoLib/HTML/TokenMgrError.cs?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/TokenMgrError.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/TokenMgrError.cs Sat Jun 3 19:41:13 2006
@@ -15,145 +15,147 @@
*/
/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */
+
using System;
+
namespace Lucene.Net.Demo.Html
{
- [Serializable]
- public class TokenMgrError:System.ApplicationException
- {
- /// <summary> You can also modify the body of this method to customize your error messages.
- /// For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
- /// of end-users concern, so you can return something like :
- ///
- /// "Internal Error : Please file a bug report .... "
- ///
- /// from this method for such cases in the release version of your parser.
- /// </summary>
- public override System.String Message
- {
- get
- {
- return base.Message;
- }
+ [Serializable]
+ public class TokenMgrError:System.ApplicationException
+ {
+ /// <summary> You can also modify the body of this method to customize your error messages.
+ /// For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+ /// of end-users concern, so you can return something like :
+ ///
+ /// "Internal Error : Please file a bug report .... "
+ ///
+ /// from this method for such cases in the release version of your parser.
+ /// </summary>
+ public override System.String Message
+ {
+ get
+ {
+ return base.Message;
+ }
- }
- /*
- * Ordinals for various reasons why an Error of this type can be thrown.
- */
-
- /// <summary> Lexical error occured.</summary>
- internal const int LEXICAL_ERROR = 0;
-
- /// <summary> An attempt wass made to create a second instance of a static token manager.</summary>
- internal const int STATIC_LEXER_ERROR = 1;
-
- /// <summary> Tried to change to an invalid lexical state.</summary>
- internal const int INVALID_LEXICAL_STATE = 2;
-
- /// <summary> Detected (and bailed out of) an infinite loop in the token manager.</summary>
- internal const int LOOP_DETECTED = 3;
-
- /// <summary> Indicates the reason why the exception is thrown. It will have
- /// one of the above 4 values.
- /// </summary>
- internal int errorCode;
-
- /// <summary> Replaces unprintable characters by their espaced (or unicode escaped)
- /// equivalents in the given string
- /// </summary>
- protected internal static System.String addEscapes(System.String str)
- {
- System.Text.StringBuilder retval = new System.Text.StringBuilder();
- char ch;
- for (int i = 0; i < str.Length; i++)
- {
- switch (str[i])
- {
-
- case (char) (0):
- continue;
-
- case '\b':
- retval.Append("\\b");
- continue;
-
- case '\t':
- retval.Append("\\t");
- continue;
-
- case '\n':
- retval.Append("\\n");
- continue;
-
- case '\f':
- retval.Append("\\f");
- continue;
-
- case '\r':
- retval.Append("\\r");
- continue;
-
- case '\"':
- retval.Append("\\\"");
- continue;
-
- case '\'':
- retval.Append("\\\'");
- continue;
-
- case '\\':
- retval.Append("\\\\");
- continue;
-
- default:
- if ((ch = str[i]) < 0x20 || ch > 0x7e)
- {
- System.String s = "0000" + System.Convert.ToString(ch, 16);
- retval.Append("\\u" + s.Substring(s.Length - 4, (s.Length) - (s.Length - 4)));
- }
- else
- {
- retval.Append(ch);
- }
- continue;
-
- }
- }
- return retval.ToString();
- }
-
- /// <summary> Returns a detailed message for the Error when it is thrown by the
- /// token manager to indicate a lexical error.
- /// Parameters :
- /// EOFSeen : indicates if EOF caused the lexicl error
- /// curLexState : lexical state in which this error occured
- /// errorLine : line number when the error occured
- /// errorColumn : column number when the error occured
- /// errorAfter : prefix that was seen before this error occured
- /// curchar : the offending character
- /// Note: You can customize the lexical error message by modifying this method.
- /// </summary>
- protected internal static System.String LexicalError(bool EOFSeen, int lexState, int errorLine, int errorColumn, System.String errorAfter, char curChar)
- {
- return ("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen?"<EOF> ":("\"" + addEscapes(System.Convert.ToString(curChar)) + "\"") + " (" + (int) curChar + "), ") + "after : \"" + addEscapes(errorAfter) + "\"");
- }
-
- /*
- * Constructors of various flavors follow.
- */
-
- public TokenMgrError()
- {
- }
-
- public TokenMgrError(System.String message, int reason):base(message)
- {
- errorCode = reason;
- }
-
- public TokenMgrError(bool EOFSeen, int lexState, int errorLine, int errorColumn, System.String errorAfter, char curChar, int reason):this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason)
- {
- }
- }
+ }
+ /*
+ * Ordinals for various reasons why an Error of this type can be thrown.
+ */
+
+ /// <summary> Lexical error occured.</summary>
+ internal const int LEXICAL_ERROR = 0;
+
+ /// <summary> An attempt wass made to create a second instance of a static token manager.</summary>
+ internal const int STATIC_LEXER_ERROR = 1;
+
+ /// <summary> Tried to change to an invalid lexical state.</summary>
+ internal const int INVALID_LEXICAL_STATE = 2;
+
+ /// <summary> Detected (and bailed out of) an infinite loop in the token manager.</summary>
+ internal const int LOOP_DETECTED = 3;
+
+ /// <summary> Indicates the reason why the exception is thrown. It will have
+ /// one of the above 4 values.
+ /// </summary>
+ internal int errorCode;
+
+ /// <summary> Replaces unprintable characters by their espaced (or unicode escaped)
+ /// equivalents in the given string
+ /// </summary>
+ protected internal static System.String addEscapes(System.String str)
+ {
+ System.Text.StringBuilder retval = new System.Text.StringBuilder();
+ char ch;
+ for (int i = 0; i < str.Length; i++)
+ {
+ switch (str[i])
+ {
+
+ case (char) (0):
+ continue;
+
+ case '\b':
+ retval.Append("\\b");
+ continue;
+
+ case '\t':
+ retval.Append("\\t");
+ continue;
+
+ case '\n':
+ retval.Append("\\n");
+ continue;
+
+ case '\f':
+ retval.Append("\\f");
+ continue;
+
+ case '\r':
+ retval.Append("\\r");
+ continue;
+
+ case '\"':
+ retval.Append("\\\"");
+ continue;
+
+ case '\'':
+ retval.Append("\\\'");
+ continue;
+
+ case '\\':
+ retval.Append("\\\\");
+ continue;
+
+ default:
+ if ((ch = str[i]) < 0x20 || ch > 0x7e)
+ {
+ System.String s = "0000" + System.Convert.ToString(ch, 16);
+ retval.Append("\\u" + s.Substring(s.Length - 4, (s.Length) - (s.Length - 4)));
+ }
+ else
+ {
+ retval.Append(ch);
+ }
+ continue;
+
+ }
+ }
+ return retval.ToString();
+ }
+
+ /// <summary> Returns a detailed message for the Error when it is thrown by the
+ /// token manager to indicate a lexical error.
+ /// Parameters :
+ /// EOFSeen : indicates if EOF caused the lexicl error
+ /// curLexState : lexical state in which this error occured
+ /// errorLine : line number when the error occured
+ /// errorColumn : column number when the error occured
+ /// errorAfter : prefix that was seen before this error occured
+ /// curchar : the offending character
+ /// Note: You can customize the lexical error message by modifying this method.
+ /// </summary>
+ protected internal static System.String LexicalError(bool EOFSeen, int lexState, int errorLine, int errorColumn, System.String errorAfter, char curChar)
+ {
+ return ("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen?"<EOF> ":("\"" + addEscapes(System.Convert.ToString(curChar)) + "\"") + " (" + (int) curChar + "), ") + "after : \"" + addEscapes(errorAfter) + "\"");
+ }
+
+ /*
+ * Constructors of various flavors follow.
+ */
+
+ public TokenMgrError()
+ {
+ }
+
+ public TokenMgrError(System.String message, int reason):base(message)
+ {
+ errorCode = reason;
+ }
+
+ public TokenMgrError(bool EOFSeen, int lexState, int errorLine, int errorColumn, System.String errorAfter, char curChar, int reason):this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason)
+ {
+ }
+ }
}
Modified: incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTMLDocument.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/DemoLib/HTMLDocument.cs?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTMLDocument.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTMLDocument.cs Sat Jun 3 19:41:13 2006
@@ -13,72 +13,74 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
using System;
using HTMLParser = Lucene.Net.Demo.Html.HTMLParser;
using Lucene.Net.Documents;
+
namespace Lucene.Net.Demo
{
- /// <summary>A utility for making Lucene Documents for HTML documents. </summary>
+ /// <summary>A utility for making Lucene Documents for HTML documents. </summary>
- public class HTMLDocument
- {
- internal static char dirSep = System.IO.Path.DirectorySeparatorChar.ToString()[0];
+ public class HTMLDocument
+ {
+ internal static char dirSep = System.IO.Path.DirectorySeparatorChar.ToString()[0];
- public static System.String UID(System.IO.FileInfo f)
- {
- // Append path and date into a string in such a way that lexicographic
- // sorting gives the same results as a walk of the file hierarchy. Thus
- // null (\u0000) is used both to separate directory components and to
- // separate the path from the date.
- return f.FullName.Replace(dirSep, '\u0000') + "\u0000" + DateField.TimeToString(((f.LastWriteTime.Ticks - 621355968000000000) / 10000));
- }
+ public static System.String Uid(System.IO.FileInfo f)
+ {
+ // Append path and date into a string in such a way that lexicographic
+ // sorting gives the same results as a walk of the file hierarchy. Thus
+ // null (\u0000) is used both to separate directory components and to
+ // separate the path from the date.
+ return f.FullName.Replace(dirSep, '\u0000') + "\u0000" + DateTools.TimeToString(((f.LastWriteTime.Ticks - 621355968000000000) / 10000), DateTools.Resolution.SECOND);
+ }
- public static System.String UID2URL(System.String uid)
- {
- System.String url = uid.Replace('\u0000', '/'); // replace nulls with slashes
- return url.Substring(0, (url.LastIndexOf((System.Char) '/')) - (0)); // remove date from end
- }
+ public static System.String Uid2url(System.String uid)
+ {
+ System.String url = uid.Replace('\u0000', '/'); // replace nulls with slashes
+ return url.Substring(0, (url.LastIndexOf('/')) - (0)); // remove date from end
+ }
- public static Document Document(System.IO.FileInfo f)
- {
- // make a new, empty document
- Document doc = new Document();
-
- // Add the url as a field named "url". Use an UnIndexed field, so
- // that the url is just stored with the document, but is not searchable.
- doc.Add(Field.UnIndexed("url", f.FullName.Replace(dirSep, '/')));
-
- // Add the last modified date of the file a field named "modified". Use a
- // Keyword field, so that it's searchable, but so that no attempt is made
- // to tokenize the field into words.
- doc.Add(Field.Keyword("modified", DateField.TimeToString(((f.LastWriteTime.Ticks - 621355968000000000) / 10000))));
-
- // Add the uid as a field, so that index can be incrementally maintained.
- // This field is not stored with document, it is indexed, but it is not
- // tokenized prior to indexing.
- doc.Add(new Field("uid", UID(f), false, true, false));
-
- HTMLParser parser = new HTMLParser(f);
-
- // Add the tag-stripped contents as a Reader-valued Text field so it will
- // get tokenized and indexed.
- doc.Add(Field.Text("contents", parser.GetReader()));
-
- // Add the summary as an UnIndexed field, so that it is stored and returned
- // with hit documents for display.
- doc.Add(Field.UnIndexed("summary", parser.GetSummary()));
-
- // Add the title as a separate Text field, so that it can be searched
- // separately.
- doc.Add(Field.Text("title", parser.GetTitle()));
-
- // return the document
- return doc;
- }
+ public static Document Document(System.IO.FileInfo f)
+ {
+ // make a new, empty document
+ Document doc = new Document();
+
+ // Add the url as a field named "path". Use a field that is
+ // indexed (i.e. searchable), but don't tokenize the field into words.
+ doc.Add(new Field("path", f.FullName.Replace(dirSep, '/'), Field.Store.YES, Field.Index.UN_TOKENIZED));
+
+ // Add the last modified date of the file a field named "modified".
+ // Use a field that is indexed (i.e. searchable), but don't tokenize
+ // the field into words.
+ doc.Add(new Field("modified", DateTools.TimeToString(((f.LastWriteTime.Ticks - 621355968000000000) / 10000), DateTools.Resolution.MINUTE), Field.Store.YES, Field.Index.UN_TOKENIZED));
+
+ // Add the uid as a field, so that index can be incrementally maintained.
+ // This field is not stored with document, it is indexed, but it is not
+ // tokenized prior to indexing.
+ doc.Add(new Field("uid", Uid(f), Field.Store.NO, Field.Index.UN_TOKENIZED));
+
+ System.IO.FileStream fis = new System.IO.FileStream(f.FullName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
+ HTMLParser parser = new HTMLParser(fis);
+
+ // Add the tag-stripped contents as a Reader-valued Text field so it will
+ // get tokenized and indexed.
+ doc.Add(new Field("contents", parser.GetReader()));
+
+ // Add the summary as a field that is stored and returned with
+ // hit documents for display.
+ doc.Add(new Field("summary", parser.GetSummary(), Field.Store.YES, Field.Index.NO));
+
+ // Add the title as a field that it can be searched and that is stored.
+ doc.Add(new Field("title", parser.GetTitle(), Field.Store.YES, Field.Index.TOKENIZED));
+
+ // return the document
+ return doc;
+ }
- private HTMLDocument()
- {
- }
- }
+ private HTMLDocument()
+ {
+ }
+ }
}
Modified: incubator/lucene.net/trunk/C#/src/Demo/IndexFiles/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/IndexFiles/AssemblyInfo.cs?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/IndexFiles/AssemblyInfo.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/IndexFiles/AssemblyInfo.cs Sat Jun 3 19:41:13 2006
@@ -26,7 +26,7 @@
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.4.3.003")]
+[assembly: AssemblyVersion("1.9.0.003")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
Modified: incubator/lucene.net/trunk/C#/src/Demo/IndexFiles/IndexFiles.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/IndexFiles/IndexFiles.cs?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/IndexFiles/IndexFiles.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/IndexFiles/IndexFiles.cs Sat Jun 3 19:41:13 2006
@@ -13,14 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
using System;
using StandardAnalyzer = Lucene.Net.Analysis.Standard.StandardAnalyzer;
using IndexWriter = Lucene.Net.Index.IndexWriter;
+
namespace Lucene.Net.Demo
{
class IndexFiles
{
+
+ internal static readonly System.IO.FileInfo INDEX_DIR = new System.IO.FileInfo("index");
+
[STAThread]
public static void Main(System.String[] args)
{
@@ -31,19 +36,41 @@
System.Environment.Exit(1);
}
+ bool tmpBool;
+ if (System.IO.File.Exists(INDEX_DIR.FullName))
+ tmpBool = true;
+ else
+ tmpBool = System.IO.Directory.Exists(INDEX_DIR.FullName);
+ if (tmpBool)
+ {
+ System.Console.Out.WriteLine("Cannot save index to '" + INDEX_DIR + "' directory, please delete it first");
+ System.Environment.Exit(1);
+ }
+
+ System.IO.FileInfo docDir = new System.IO.FileInfo(args[0]);
+ bool tmpBool2;
+ if (System.IO.File.Exists(docDir.FullName))
+ tmpBool2 = true;
+ else
+ tmpBool2 = System.IO.Directory.Exists(docDir.FullName);
+ if (!tmpBool2) // || !docDir.canRead()) // {{Aroush}} what is canRead() in C#?
+ {
+ System.Console.Out.WriteLine("Document directory '" + docDir.FullName + "' does not exist or is not readable, please check the path");
+ System.Environment.Exit(1);
+ }
+
System.DateTime start = System.DateTime.Now;
try
{
- IndexWriter writer = new IndexWriter("index", new StandardAnalyzer(), true);
- IndexDocs(writer, new System.IO.FileInfo(args[0]));
-
+ IndexWriter writer = new IndexWriter(INDEX_DIR, new StandardAnalyzer(), true);
+ System.Console.Out.WriteLine("Indexing to directory '" + INDEX_DIR + "'...");
+ IndexDocs(writer, docDir);
+ System.Console.Out.WriteLine("Optimizing...");
writer.Optimize();
writer.Close();
System.DateTime end = System.DateTime.Now;
-
- System.Console.Out.Write(end.Ticks - start.Ticks);
- System.Console.Out.WriteLine(" total milliseconds");
+ System.Console.Out.WriteLine(end.Ticks - start.Ticks + " total milliseconds");
}
catch (System.IO.IOException e)
{
@@ -53,30 +80,34 @@
public static void IndexDocs(IndexWriter writer, System.IO.FileInfo file)
{
- if (System.IO.Directory.Exists(file.FullName))
+ // do not try to index files that cannot be read
+ // if (file.canRead()) // {{Aroush}} what is canRead() in C#?
{
- System.String[] files = System.IO.Directory.GetFileSystemEntries(file.FullName);
- // an IO error could occur
- if (files != null)
+ if (System.IO.Directory.Exists(file.FullName))
{
- for (int i = 0; i < files.Length; i++)
+ System.String[] files = System.IO.Directory.GetFileSystemEntries(file.FullName);
+ // an IO error could occur
+ if (files != null)
{
- IndexDocs(writer, new System.IO.FileInfo(files[i]));
+ for (int i = 0; i < files.Length; i++)
+ {
+ IndexDocs(writer, new System.IO.FileInfo(files[i]));
+ }
}
}
- }
- else
- {
- System.Console.Out.WriteLine("adding " + file);
- try
+ else
{
- writer.AddDocument(FileDocument.Document(file));
- }
- // at least on windows, some temporary files raise this exception with an "access denied" message
- // checking if the file can be read doesn't help
- catch (System.IO.FileNotFoundException fnfe)
- {
- ;
+ System.Console.Out.WriteLine("adding " + file);
+ try
+ {
+ writer.AddDocument(FileDocument.Document(file));
+ }
+ // at least on windows, some temporary files raise this exception with an "access denied" message
+ // checking if the file can be read doesn't help
+ catch (System.IO.FileNotFoundException fnfe)
+ {
+ ;
+ }
}
}
}
Modified: incubator/lucene.net/trunk/C#/src/Demo/IndexFiles/IndexFiles.csproj
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/IndexFiles/IndexFiles.csproj?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/IndexFiles/IndexFiles.csproj (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/IndexFiles/IndexFiles.csproj Sat Jun 3 19:41:13 2006
@@ -87,7 +87,7 @@
<Reference
Name = "Lucene.Net"
AssemblyName = "Lucene.Net"
- HintPath = "..\..\bin\Release\Lucene.Net.dll"
+ HintPath = "..\..\Lucene.Net\bin\Debug\Lucene.Net.dll"
/>
</References>
</Build>
Modified: incubator/lucene.net/trunk/C#/src/Demo/IndexFiles/IndexFiles.csproj.user
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/IndexFiles/IndexFiles.csproj.user?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/IndexFiles/IndexFiles.csproj.user (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/IndexFiles/IndexFiles.csproj.user Sat Jun 3 19:41:13 2006
@@ -1,7 +1,7 @@
<VisualStudioProject>
<CSHARP LastOpenVersion = "7.10.3077" >
<Build>
- <Settings ReferencePath = "E:\Aroush.proj\Lucene.Net-1.4.3.final-002\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.3.final-001\bin\Release\;E:\Aroush.proj\Lucene.Net-1.4.3.Final-001\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.3.RC2-001\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.3.RC1-001\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.3-beta.002\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.3-beta.001\bin\Release\;E:\Aroush.proj\Lucene.Net-1.4.3-beta.001\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.RC1-001\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.beta-003\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.beta-001\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.alpha-006\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.alpha-005\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.alpha-004\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.alpha-003\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.alpha-002\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.alpha-001\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.3\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.3.f
inal-002\bin\Release\;E:\Aroush.proj\Lucene.Net-1.4.3.final-003\bin\Debug\" >
+ <Settings ReferencePath = "E:\Aroush.proj\Lucene.Net-1.9.rc1-002.src\Lucene.Net\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.9.rc1-003.src\Lucene.Net\bin\Debug\" >
<Config
Name = "Debug"
EnableASPDebugging = "false"
@@ -11,7 +11,7 @@
RemoteDebugEnabled = "false"
RemoteDebugMachine = ""
StartAction = "Project"
- StartArguments = "F:\temp\"
+ StartArguments = "e:\temp\"
StartPage = ""
StartProgram = ""
StartURL = ""
@@ -27,12 +27,12 @@
RemoteDebugEnabled = "false"
RemoteDebugMachine = ""
StartAction = "Project"
- StartArguments = "F:\temp\"
+ StartArguments = ""
StartPage = ""
StartProgram = ""
StartURL = ""
StartWorkingDirectory = ""
- StartWithIE = "true"
+ StartWithIE = "false"
/>
</Settings>
</Build>
Modified: incubator/lucene.net/trunk/C#/src/Demo/IndexHtml/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/IndexHtml/AssemblyInfo.cs?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/IndexHtml/AssemblyInfo.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/IndexHtml/AssemblyInfo.cs Sat Jun 3 19:41:13 2006
@@ -26,7 +26,7 @@
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.4.3.003")]
+[assembly: AssemblyVersion("1.9.0.003")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
Modified: incubator/lucene.net/trunk/C#/src/Demo/IndexHtml/IndexHtml.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/IndexHtml/IndexHtml.cs?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/IndexHtml/IndexHtml.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/IndexHtml/IndexHtml.cs Sat Jun 3 19:41:13 2006
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
using System;
using StandardAnalyzer = Lucene.Net.Analysis.Standard.StandardAnalyzer;
using Document = Lucene.Net.Documents.Document;
@@ -20,11 +21,13 @@
using IndexWriter = Lucene.Net.Index.IndexWriter;
using Term = Lucene.Net.Index.Term;
using TermEnum = Lucene.Net.Index.TermEnum;
+
namespace Lucene.Net.Demo
{
class IndexHTML
{
+
private static bool deleting = false; // true during deletion pass
private static IndexReader reader; // existing index
private static IndexWriter writer; // new index being built
@@ -76,10 +79,9 @@
deleting = true;
IndexDocs(root, index, create);
}
-
- writer = new IndexWriter(index, new StandardAnalyzer(), create);
- writer.maxFieldLength = 1000000;
-
+
+ writer = new IndexWriter(index, new StandardAnalyzer(), create);
+ writer.SetMaxFieldLength(1000000);
IndexDocs(root, index, create); // add new docs
System.Console.Out.WriteLine("Optimizing index...");
@@ -119,7 +121,7 @@
// delete rest of stale docs
while (uidIter.Term() != null && (System.Object) uidIter.Term().Field() == (System.Object) "uid")
{
- System.Console.Out.WriteLine("deleting " + HTMLDocument.UID2URL(uidIter.Term().Text()));
+ System.Console.Out.WriteLine("deleting " + HTMLDocument.Uid2url(uidIter.Term().Text()));
reader.Delete(uidIter.Term());
uidIter.Next();
}
@@ -143,7 +145,7 @@
System.Array.Sort(files); // sort the files
for (int i = 0; i < files.Length; i++)
// recursively index them
- IndexDocs(new System.IO.FileInfo(files[i]));
+ IndexDocs(new System.IO.FileInfo(file.FullName + "\\" + files[i]));
}
else if (file.FullName.EndsWith(".html") || file.FullName.EndsWith(".htm") || file.FullName.EndsWith(".txt"))
{
@@ -151,14 +153,14 @@
if (uidIter != null)
{
- System.String uid = HTMLDocument.UID(file); // construct uid for doc
+ System.String uid = HTMLDocument.Uid(file); // construct uid for doc
while (uidIter.Term() != null && (System.Object) uidIter.Term().Field() == (System.Object) "uid" && String.CompareOrdinal(uidIter.Term().Text(), uid) < 0)
{
if (deleting)
{
// delete stale docs
- System.Console.Out.WriteLine("deleting " + HTMLDocument.UID2URL(uidIter.Term().Text()));
+ System.Console.Out.WriteLine("deleting " + HTMLDocument.Uid2url(uidIter.Term().Text()));
reader.Delete(uidIter.Term());
}
uidIter.Next();
@@ -171,7 +173,7 @@
{
// add new docs
Document doc = HTMLDocument.Document(file);
- System.Console.Out.WriteLine("adding " + doc.Get("url"));
+ System.Console.Out.WriteLine("adding " + doc.Get("path"));
writer.AddDocument(doc);
}
}
@@ -179,7 +181,7 @@
{
// creating a new index
Document doc = HTMLDocument.Document(file);
- System.Console.Out.WriteLine("adding " + doc.Get("url"));
+ System.Console.Out.WriteLine("adding " + doc.Get("path"));
writer.AddDocument(doc); // add docs unconditionally
}
}
Modified: incubator/lucene.net/trunk/C#/src/Demo/IndexHtml/IndexHtml.csproj
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/IndexHtml/IndexHtml.csproj?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/IndexHtml/IndexHtml.csproj (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/IndexHtml/IndexHtml.csproj Sat Jun 3 19:41:13 2006
@@ -87,7 +87,7 @@
<Reference
Name = "Lucene.Net"
AssemblyName = "Lucene.Net"
- HintPath = "..\..\bin\Release\Lucene.Net.dll"
+ HintPath = "..\..\Lucene.Net\bin\Debug\Lucene.Net.dll"
/>
</References>
</Build>
Modified: incubator/lucene.net/trunk/C#/src/Demo/IndexHtml/IndexHtml.csproj.user
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/IndexHtml/IndexHtml.csproj.user?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/IndexHtml/IndexHtml.csproj.user (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/IndexHtml/IndexHtml.csproj.user Sat Jun 3 19:41:13 2006
@@ -1,7 +1,7 @@
<VisualStudioProject>
<CSHARP LastOpenVersion = "7.10.3077" >
<Build>
- <Settings ReferencePath = "E:\Aroush.proj\Lucene.Net-1.4.3.final-002\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.3.final-001\bin\Release\;E:\Aroush.proj\Lucene.Net-1.4.3.Final-001\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.3.RC2-001\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.3.RC1-001\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.3-beta.002\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.3-beta.001\bin\Release\;E:\Aroush.proj\Lucene.Net-1.4.3-beta.001\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.RC1-001\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.beta-003\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.beta-001\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.alpha-006\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.alpha-005\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.alpha-004\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.alpha-003\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.alpha-002\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.alpha-001\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.3\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.4.3.f
inal-002\bin\Release\;E:\Aroush.proj\Lucene.Net-1.4.3.final-003\bin\Debug\" >
+ <Settings ReferencePath = "E:\Aroush.proj\Lucene.Net-1.9.rc1-002.src\Lucene.Net\bin\Debug\;E:\Aroush.proj\Lucene.Net-1.9.rc1-003.src\Lucene.Net\bin\Debug\" >
<Config
Name = "Debug"
EnableASPDebugging = "false"
@@ -11,12 +11,12 @@
RemoteDebugEnabled = "false"
RemoteDebugMachine = ""
StartAction = "Project"
- StartArguments = "-create c:\test\index.html"
+ StartArguments = ""
StartPage = ""
StartProgram = ""
StartURL = ""
StartWorkingDirectory = ""
- StartWithIE = "true"
+ StartWithIE = "false"
/>
<Config
Name = "Release"
@@ -32,7 +32,7 @@
StartProgram = ""
StartURL = ""
StartWorkingDirectory = ""
- StartWithIE = "true"
+ StartWithIE = "false"
/>
</Settings>
</Build>
Modified: incubator/lucene.net/trunk/C#/src/Demo/SearchFiles/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/SearchFiles/AssemblyInfo.cs?rev=411501&r1=411500&r2=411501&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/SearchFiles/AssemblyInfo.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/SearchFiles/AssemblyInfo.cs Sat Jun 3 19:41:13 2006
@@ -26,7 +26,7 @@
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.4.3.003")]
+[assembly: AssemblyVersion("1.9.0.003")]
//
// In order to sign your assembly you must specify a key to use. Refer to the