From 53885b52d9df28b6c9bb74d03110410cbde98e99 Mon Sep 17 00:00:00 2001 From: kpouer Date: Sun, 2 Feb 2003 17:21:02 +0000 Subject: [PATCH] Some javadoc added --- .../phpeclipse/phpeditor/phpparser/PHPParser.java | 32 ++++++++++++++++++-- .../phpeditor/phpparser/SyntaxError.java | 22 +++++++++++-- 2 files changed, 47 insertions(+), 7 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/phpparser/PHPParser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/phpparser/PHPParser.java index 7e87efa..624975a 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/phpparser/PHPParser.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/phpparser/PHPParser.java @@ -197,6 +197,12 @@ public class PHPParser extends PHPKeywords { } } + /** + * This method will throw the SyntaxError. + * It will add the good lines and columns to the Error + * @param error the error message + * @throws SyntaxError the error raised + */ private void throwSyntaxError(String error) { if (str.length() < chIndx) { @@ -214,8 +220,13 @@ public class PHPParser extends PHPKeywords { throw new SyntaxError(rowCount, chIndx - columnCount + 1, str.substring(columnCount, eol), error); } + /** + * This method will throw the SyntaxError. + * It will add the good lines and columns to the Error + * @param error the error message + * @throws SyntaxError the error raised + */ private void throwSyntaxError(String error, int startRow) { - throw new SyntaxError(startRow, 0, " ", error); } @@ -1264,7 +1275,9 @@ public class PHPParser extends PHPKeywords { // } } - + /** + * Get an identifier. + */ private void getIdentifier() { // StringBuffer ident = new StringBuffer(); int startPosition = chIndx - 1; @@ -1280,11 +1293,13 @@ public class PHPParser extends PHPKeywords { } getChar(); + + //this will read the buffer until the next character is a forbidden character for identifier while ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || (ch == '_')) { // ident.append(ch); getChar(); } - int endPosition = chIndx--; + int endPosition = chIndx--; int length = (--endPosition) - startPosition; identifier = str.substring(startPosition, endPosition); @@ -1298,6 +1313,13 @@ public class PHPParser extends PHPKeywords { } } + /** + * Get a number. + * if it's a double the number will be stored in doubleNumber and the token will have the + * value {@link PHPParser#TT_DOUBLE_NUMBER}
+ * if it's a double the number will be stored in longNumber and the token will have the + * value {@link PHPParser#TT_INT_NUMBER} + */ private void getNumber() { StringBuffer inum = new StringBuffer(); char dFlag = ' '; @@ -3298,6 +3320,10 @@ public class PHPParser extends PHPKeywords { } } + /** + * It will look for a value (after a '=' for example) + * @throws CoreException + */ private void constant() throws CoreException { String ident; switch (token) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/phpparser/SyntaxError.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/phpparser/SyntaxError.java index 5da81e8..7c174da 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/phpparser/SyntaxError.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/phpparser/SyntaxError.java @@ -19,19 +19,25 @@ package net.sourceforge.phpeclipse.phpeditor.phpparser; /** - * Exception for a syntax error detected by the HartMath parser - * + * Exception for a syntax error detected by the HartMath parser. */ public class SyntaxError extends Error { + /** The line where the error start */ int lineNumber; + /** The column where the error start */ int columnNumber; + /** the current line. */ String currentLine; + /** The error message. */ String error; + /** * SyntaxError exception - * - * + * @param lineNumber the line number where the error start + * @param columnNumber the column where the error start + * @param currentLine the line where the error end + * @param error the error message * @see */ public SyntaxError(int lineNumber, int columnNumber, String currentLine, String error) { @@ -41,6 +47,10 @@ public class SyntaxError extends Error { this.error = error; } + /** + * Get the error message. + * @return the error message + */ public String getMessage() { // StringBuffer buf = new StringBuffer(256); // buf.append("Syntax error in line:"); @@ -59,6 +69,10 @@ public class SyntaxError extends Error { return error; } + /** + * Get the line number where the error happens + * @return the line number + */ public int getLine() { return lineNumber; } -- 1.7.1