OSDN Git Service

compiler-calculated maximum value for `m_SourceDefs` (#966)
[winmerge-jp/winmerge-jp.git] / Externals / crystaledit / editlib / parsers / java.cpp
1 ///////////////////////////////////////////////////////////////////////////
2 //  File:    java.cpp
3 //  Version: 1.1.0.4
4 //  Updated: 19-Jul-1998
5 //
6 //  Copyright:  Ferdinand Prantl, portions by Stcherbatchenko Andrei
7 //  E-mail:     prantl@ff.cuni.cz
8 //
9 //  Java syntax highlighing definition
10 //
11 //  You are free to use or modify this code to the following restrictions:
12 //  - Acknowledge me somewhere in your about box, simple "Parts of code by.."
13 //  will be enough. If you can't (or don't want to), contact me personally.
14 //  - LEAVE THIS HEADER INTACT
15 ////////////////////////////////////////////////////////////////////////////
16
17 #include "StdAfx.h"
18 #include "crystallineparser.h"
19 #include "../SyntaxColors.h"
20 #include "../utils/string_util.h"
21
22 #ifdef _DEBUG
23 #define new DEBUG_NEW
24 #endif
25
26 //  C++ keywords (MSVC5.0 + POET5.0)
27 static const TCHAR * s_apszJavaKeywordList[] =
28   {
29     _T ("abstract"),
30     _T ("boolean"),
31     _T ("break"),
32     _T ("byte"),
33     _T ("byvalue"),
34     _T ("case"),
35     _T ("catch"),
36     _T ("char"),
37     _T ("class"),
38     _T ("const"),
39     _T ("continue"),
40     _T ("default"),
41     _T ("do"),
42     _T ("double"),
43     _T ("else"),
44     _T ("extends"),
45     _T ("false"),
46     _T ("final"),
47     _T ("finally"),
48     _T ("float"),
49     _T ("for"),
50     _T ("goto"),
51     _T ("if"),
52     _T ("implements"),
53     _T ("import"),
54     _T ("instanceof"),
55     _T ("int"),
56     _T ("interface"),
57     _T ("long"),
58     _T ("native"),
59     _T ("new"),
60     _T ("null"),
61     _T ("package"),
62     _T ("private"),
63     _T ("protected"),
64     _T ("public"),
65     _T ("return"),
66     _T ("short"),
67     _T ("static"),
68     _T ("super"),
69     _T ("switch"),
70     _T ("synchronized"),
71     _T ("this"),
72     _T ("threadsafe"),
73     _T ("throw"),
74     _T ("transient"),
75     _T ("true"),
76     _T ("try"),
77     _T ("void"),
78     _T ("while"),
79   };
80
81 static bool
82 IsJavaKeyword (const TCHAR *pszChars, int nLength)
83 {
84   return ISXKEYWORD (s_apszJavaKeywordList, pszChars, nLength);
85 }
86
87 unsigned
88 CrystalLineParser::ParseLineJava (unsigned dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
89 {
90   return ParseLineCJava (dwCookie, pszChars, nLength, pBuf, nActualItems, IsJavaKeyword, nullptr);
91 }