Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/Script.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations) (download) (as text)
Sun Aug 15 01:53:13 2010 UTC (13 years, 9 months ago) by okadu
File MIME type: text/x-chdr
File size: 2291 byte(s)


1 #ifndef SCRIPT_H_INCLUDED
2 #define SCRIPT_H_INCLUDED
3
4 // 定形エラー
5 #define ERR_ENDBLOCK lang(SyntaxError)
6
7 /*
8 * エラーハンドラ
9 */
10 class CSynErr{
11 private:
12 char *m_ErrorPos; // エラー発生箇所
13 string m_Message; // データ
14 public:
15 CSynErr(char *);
16 CSynErr(char *, const char *, ...);
17 char *Get(){ return (char *)m_Message.c_str(); }
18 void Handle(string, char *);
19 };
20
21 // 関数宣言
22 char *Space(char *);
23 char *ConstInteger(char *, int *);
24 char *ConstFloat(char *, float *);
25 char *ColorValue(char *, D3DCOLOR *);
26 char *HexPointer(char *, void **);
27 char *Vector2D(char *, VEC3 *);
28 char *Vector3D(char *, VEC3 *);
29 char *Identifier(char *, string *);
30 char *StringLiteral(char *, string *);
31 char *BoolYesNo(char *, bool *);
32 char *Identifier2(char *, char *);
33 char *Assignment(char *, char *);
34 char *AsgnInteger(char *, char *, int *, int n = 1, bool fill = false);
35 char *AsgnFloat(char *, char *, float *, int n = 1, bool fill = false);
36 char *AsgnColor(char *, char *, D3DCOLOR *, int n = 1, bool fill = false);
37 char *AsgnPointer(char *, char *, void **, int n = 1, bool fill = false);
38 char *AsgnVector2D(char *, char *, VEC2 *, int n = 1, bool fill = false);
39 char *AsgnVector3D(char *, char *, VEC3 *, int n = 1, bool fill = false);
40 char *AsgnIdentifier(char *, char *, string *, int n = 1, bool fill = false);
41 char *AsgnString(char *, char *, string *, int n = 1, bool fill = false);
42 char *AsgnYesNo(char *, char *, bool *, int n = 1, bool fill = false);
43 char *BeginBlock(char *, char *);
44 char *BeginNamedBlock(char *, char *, string *);
45 char *EndBlock(char *);
46
47 /*
48 * 任意文字
49 */
50 inline char *Character(
51 char *str, // 対象文字列
52 char read // 読取文字
53 ){
54 if(*str==read) return str+1;
55 return NULL;
56 }
57
58 /*
59 * 任意文字 + 空白スキップ
60 */
61 inline char *Character2(
62 char *str, // 対象文字列
63 char read // 読取文字
64 ){
65 return (str = Character(str, read)) ? Space(str) : NULL;
66 }
67
68 /*
69 * 任意列
70 */
71 inline char *String(
72 char *str, // 対象文字列
73 char *read // 読取文字列
74 ){
75 while(*read) if(*read++!=*str++) return NULL;
76 return str;
77 }
78
79 /*
80 * 任意列 + 空白スキップ
81 */
82 inline char *String2(
83 char *str, // 対象文字列
84 char *read // 読取文字列
85 ){
86 return (str = String(str, read)) ? Space(str) : NULL;
87 }
88
89 #endif

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26