+ throw runtime_error(format_syntax_error("a statement"));
+}
+
+RefPtr<Import> ProgramParser::parse_import()
+{
+ if(cur_stage->type!=SHARED)
+ throw runtime_error(format_error("Imports are only allowed in the shared section"));
+
+ expect("import");
+ RefPtr<Import> import = new Import;
+ import->module = parse_token();
+ expect(";");
+ return import;
+}
+
+RefPtr<Precision> ProgramParser::parse_precision()
+{
+ expect("precision");
+ RefPtr<Precision> precision = new Precision;
+
+ precision->precision = parse_token();
+ if(!is_precision_qualifier(precision->precision))
+ throw runtime_error(format_syntax_error("a precision qualifier"));
+
+ precision->type = parse_token();
+ // Not entirely accurate; only float, int and sampler types are allowed
+ if(!is_builtin_type(precision->type))
+ throw runtime_error(format_syntax_error("a builtin type"));
+
+ expect(";");
+
+ return precision;