intial source from ttp://www.sf.net/projects/wdte
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.js.core / src / net / sourceforge / phpeclipse / js / core / parser / JSStringScanner.java
1 /*
2  * $RCSfile: JSStringScanner.java,v $
3  *
4  * Copyright 2002
5  * CH-1700 Fribourg, Switzerland
6  * All rights reserved.
7  *
8  *========================================================================
9  * Modifications history
10  *========================================================================
11  * $Log: not supported by cvs2svn $
12  * Revision 1.1  2004/02/26 02:25:42  agfitzp
13  * renamed packages to match xml & css
14  *
15  * Revision 1.1  2004/02/05 03:10:08  agfitzp
16  * Initial Submission
17  *
18  * Revision 1.1.2.1  2003/12/12 21:37:24  agfitzp
19  * Experimental work for Classes view
20  *
21  * Revision 1.1  2003/05/28 15:17:11  agfitzp
22  * net.sourceforge.phpeclipse.js.core 0.0.1 code base
23  *
24  *========================================================================
25 */
26
27 package net.sourceforge.phpeclipse.js.core.parser;
28
29 import org.eclipse.jface.text.*;
30 import java.util.*;
31 import org.eclipse.jface.text.rules.*;
32
33 import org.eclipse.swt.graphics.Color;
34
35
36 /**
37  * 
38  *
39  * @author $Author: jsurfer $, $Date: 2004-09-02 18:14:38 $
40  *
41  * @version $Revision: 1.1 $
42  */
43 public class JSStringScanner extends RuleBasedScanner
44 {
45    /**
46     * Creates a new JSFuncScanner object.
47     *
48     * @param manager 
49     */
50    public JSStringScanner(Color aColor)
51    {
52       IToken string = new Token(new TextAttribute(aColor));
53       Vector rules = new Vector();
54
55       // Add rule for single and double quotes
56       rules.add(new SingleLineRule("\"", "\"", string, '\\'));
57       rules.add(new SingleLineRule("'", "'", string, '\\'));
58
59
60       // Add generic whitespace rule.
61       rules.add(new WhitespaceRule(new JSWhitespaceDetector()));
62
63       IRule[] result = new IRule[rules.size()];
64       rules.copyInto(result);
65       setRules(result);
66    }
67
68    /**
69     *
70     *
71     * @return 
72     */
73    public IToken nextToken()
74    {
75       return super.nextToken();
76    }
77 }