aboutsummaryrefslogtreecommitdiffstats
path: root/codeline.h
blob: b4c5ccb0e2170caf16be467a1156cd8eb142b404 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef INCLUDE_BLASSIC_CODELINE_H
#define INCLUDE_BLASSIC_CODELINE_H

//	codeline.h
// Revision 11-jul-2004

#include "blassic.h"
#include "keyword.h"

class CodeLine {
	const BlChar * strcontent;
	BlLineNumber linenumber;
	BlLineLength len;
	bool owner;
	BlLineLength pos;
	BlChunk chk;
	BlCode lastcode;
public:
	class Token {
	public:
		BlCode code;
		std::string str;
		BlInteger valueint;
		static BlNumber number (const std::string & str);
		BlNumber number () const;
		BlInteger integer () const { return valueint; }
		inline bool isendsentence () const
		{
			return code == ':' ||
				code == keyENDLINE ||
				code == keyELSE;
		}
	};

	CodeLine ();
	CodeLine (const BlChar * str, BlLineNumber number,
		BlLineLength length);
	CodeLine (const CodeLine & old);
	~CodeLine ();
	void assign (const BlChar * str, BlLineNumber number,
		BlLineLength length);
	CodeLine & operator= (const CodeLine & old);
	bool empty () const { return len == 0; }
	BlLineNumber number () const { return linenumber; }
	void setnumber (BlLineNumber n) { linenumber= n; }
	BlLineLength length () const { return len; }
	BlChunk chunk () const { return chk; }
	//BlChar * content () { return strcontent; }
	const BlChar * content () const { return strcontent; }
	BlCode actualcode () const { return lastcode; }
	Token getdata ();
	//Token gettoken ();
	void gettoken (Token & r);
	void gotochunk (BlChunk chknew);
	void scan (const std::string & line);
};

#endif

// Fin de codeline.h
Un proyecto texto-plano.xyz