codeline.h

来自「由一个古老的BASIC解释器改进而成, 保留了ANSI C固有的艺术美感.」· C头文件 代码 · 共 69 行

H
69
字号
//	codeline.h

#ifndef CODELINE_H_
#define CODELINE_H_

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

class Program;

class CodeLine {
	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 isnumeric ()
		{
			return isnumberfunction (code) || code == keyNUMBER ||
				code == keyINTEGER ||
				(code == keyIDENTIFIER &&
					typeofvar (str) == VarNumber);
		}
		inline bool isendsentence () const
		{
			return code == ':' ||
				code == keyENDLINE || 
				code == keyELSE;
		}
	};

	CodeLine ();
	CodeLine (BlChar * str, BlLineNumber number, BlLineLength length);
	CodeLine (const CodeLine & old);
	~CodeLine ();
	void assign (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);
	void execute (Program & program);
};

#endif

// Fin de codeline.h

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?