File: Lookup.h

package info (click to toggle)
storm-lang 0.7.4-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 52,004 kB
  • sloc: ansic: 261,462; cpp: 140,405; sh: 14,891; perl: 9,846; python: 2,525; lisp: 2,504; asm: 860; makefile: 678; pascal: 70; java: 52; xml: 37; awk: 12
file content (50 lines) | stat: -rw-r--r-- 1,249 bytes parent folder | download | duplicates (2)
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
#pragma once
#include "Compiler/Syntax/Parser.h"
#include "Compiler/Scope.h"

namespace storm {
	namespace bs {
		STORM_PKG(lang.bs);

		class BSLookup : public ScopeLookup {
			STORM_CLASS;
		public:
			// Create, optionally specify includes.
			STORM_CTOR BSLookup();
			STORM_CTOR BSLookup(Array<Package *> *includes);

			// Clone.
			virtual ScopeLookup *STORM_FN clone() const;

			// Add included package, taking exports into account.
			Bool STORM_FN addInclude(Package *p);

			// Add included package, possibly ignoring exports.
			Bool STORM_FN addInclude(Package *p, Bool useExports);

			// Get all included packages.
			Array<Package *> *STORM_FN includes() const;

			// Find things.
			virtual MAYBE(Named *) STORM_FN find(Scope in, SimpleName *name);

			// Add syntax to a parser.
			void STORM_FN addSyntax(Scope from, syntax::ParserBase *to);

		private:
			// Included packages.
			Array<Package *> *toInclude;

			// Packages that are in 'includes'.
			Set<TObject *> *inIncludes;
		};

		// Add includes. Note: it is generally more efficient to add multiple includes at once.
		Bool STORM_FN addInclude(Scope to, Package *p);

		// Add syntax to a parser.
		void STORM_FN addSyntax(Scope from, syntax::ParserBase *to);


	}
}