KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > core > util > CommentRecorderScanner


1 /*******************************************************************************
2  * Copyright (c) 2004, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.core.util;
12
13 import org.eclipse.jdt.internal.compiler.parser.Scanner;
14
15 /**
16  * Internal scanner used for DOM AST nodes.
17  *
18  * @since 3.0
19  */

20 public class CommentRecorderScanner extends Scanner {
21
22     public CommentRecorderScanner(
23         boolean tokenizeComments,
24         boolean tokenizeWhiteSpace,
25         boolean checkNonExternalizedStringLiterals,
26         long sourceLevel,
27         char[][] taskTags,
28         char[][] taskPriorities,
29         boolean isTaskCaseSensitive) {
30         super(tokenizeComments, tokenizeWhiteSpace, checkNonExternalizedStringLiterals, sourceLevel, taskTags, taskPriorities, isTaskCaseSensitive);
31     }
32     
33     /**
34      * Set start position negative for line comments.
35      * @see org.eclipse.jdt.internal.compiler.parser.Scanner#recordComment(int)
36      */

37     public void recordComment(int token) {
38         super.recordComment(token);
39         if (token == TokenNameCOMMENT_LINE) {
40             // for comment line both positions are negative
41
this.commentStarts[this.commentPtr] = -this.commentStarts[this.commentPtr];
42         }
43     }
44 }
45
Popular Tags