souffle
2.0.2-371-g6315b36
|
Go to the documentation of this file.
52 translationUnit = mk<ast::TranslationUnit>(mk<ast::Program>(), errorReport, debugReport);
55 data.yyfilename = filename;
59 yy::parser parser(*
this, scanner);
69 translationUnit = mk<ast::TranslationUnit>(mk<ast::Program>(), errorReport, debugReport);
72 data.yyfilename =
"<in-memory>";
76 yy::parser parser(*
this, scanner);
87 return parser.
parse(filename, in, errorReport, debugReport);
93 return parser.
parse(code, errorReport, debugReport);
102 const std::string& name = f->getName();
106 if (existingFunctorDecl !=
nullptr) {
109 {DiagnosticMessage(
"Previous definition", existingFunctorDecl->getSrcLoc())});
117 const auto& name = r->getQualifiedName();
122 {DiagnosticMessage(
"Previous definition", prev->getSrcLoc())});
133 if (cur->getQualifiedName() == directive->getQualifiedName() &&
137 toString(directive->getQualifiedName()),
138 directive->getSrcLoc()),
139 {DiagnosticMessage(
"Previous definition", cur->getSrcLoc())});
146 if (cur->getQualifiedName() == directive->getQualifiedName() &&
150 toString(directive->getQualifiedName()),
151 directive->getSrcLoc()),
152 {DiagnosticMessage(
"Previous definition", cur->getSrcLoc())});
163 const auto& name =
type->getQualifiedName();
165 [&](
const ast::Type* current) { return current->getQualifiedName() == name; });
166 if (existingType !=
nullptr) {
169 {DiagnosticMessage(
"Previous definition", existingType->getSrcLoc())});
209 return addTag(tag, std::move(tagLoc), std::move(tags));
219 return addTag(tag, {tag}, std::move(tagLoc), std::move(tags));
224 if (
any_of(incompatible, [&](
auto&& x) {
return contains(tags, x); })) {
235 warning(loc,
"Deprecated type declaration used");
237 return mk<ast::SubsetType>(std::move(name), std::move(baseTypeName), std::move(loc));
static Own< ast::TranslationUnit > parseTranslationUnit(const std::string &filename, FILE *in, ErrorReport &errorReport, DebugReport &debugReport)
std::set< RelationTag > addReprTag(RelationTag tag, SrcLocation tagLoc, std::set< RelationTag > tags)
void addPragma(Own< ast::Pragma > p)
User-defined functor declaration.
std::vector< FunctorDeclaration * > getFunctorDeclarations() const
Return functor declarations.
void addDirective(Own< ast::Directive > d)
void addFunctorDeclaration(Own< ast::FunctorDeclaration > f)
void addRelation(Own< ast::Relation > r)
bool contains(const C &container, const typename C::value_type &element)
A utility to check generically whether a given element is contained in a given container.
Defines a relation with a name, attributes, qualifiers, and internal representation.
std::set< RelationTag > addDeprecatedTag(RelationTag tag, SrcLocation tagLoc, std::set< RelationTag > tags)
An abstract base class for types to be covered within a type environment.
void addPragma(Own< Pragma > pragma)
void addComponent(Own< Component > component)
Add component.
void addInstantiation(Own< ast::ComponentInit > ci)
void yyset_in(FILE *in_str, yyscan_t scanner)
const std::string & toString(const std::string &str)
A generic function converting strings into strings (trivial case).
The program class consists of relations, clauses and types.
void addType(Own< ast::Type > type)
struct yy_buffer_state * YY_BUFFER_STATE
Relation * getRelation(const Program &program, const QualifiedName &name)
Returns the relation with the given name in the program.
detail::joined_sequence< Iter, Printer > join(const Iter &a, const Iter &b, const std::string &sep, const Printer &p)
Creates an object to be forwarded to some output stream for printing sequences of elements interspers...
Class representing a HTML report, consisting of a list of sections.
bool any_of(const Container &c, UnaryPredicate p)
A generic test checking whether any elements within a container satisfy a certain predicate.
void addType(Own< Type > type)
Add a type declaration.
void addClause(Own< Clause > clause)
Add a clause.
RelationTag
Space of user-chosen tags that a relation can have.
void addClause(Own< ast::Clause > c)
Own< ast::TranslationUnit > translationUnit
void addRelation(Own< Relation > relation)
Own< ast::SubsetType > mkDeprecatedSubType(ast::QualifiedName name, ast::QualifiedName attr, SrcLocation loc)
std::vector< Directive * > getDirectives() const
Return relation directives.
std::vector< Type * > getTypes() const
Return types.
C::value_type getIf(const C &container, std::function< bool(const typename C::value_type)> pred)
Returns the first element in a container that satisfies a given predicate, nullptr otherwise.
static MainConfig & config()
std::set< RelationTag > addTag(RelationTag tag, SrcLocation tagLoc, std::set< RelationTag > tags)
Own< ast::TranslationUnit > parse(const std::string &filename, FILE *in, ErrorReport &errorReport, DebugReport &debugReport)
A class describing a range in an input file.
void addIoFromDeprecatedTag(ast::Relation &r)
YY_BUFFER_STATE yy_scan_string(const char *, yyscan_t scanner)
void error(const SrcLocation &loc, const std::string &msg)
void addFunctorDeclaration(Own< FunctorDeclaration > functor)
void addComponent(Own< ast::Component > c)
constexpr auto data(C &c) -> decltype(c.data())
int yylex_init_extra(scanner_data *data, yyscan_t *scanner)
int yylex_destroy(yyscan_t scanner)
void addInstantiation(Own< ComponentInit > instantiation)
Add component instantiation.
void addDirective(Own< Directive > directive)
Add relation directive.
Qualified Name class defines fully/partially qualified names to identify objects in components.
void rel(size_t limit, bool showLimit=true)
void warning(const SrcLocation &loc, const std::string &msg)
a horizontalBars(j=m=void 0===a.axisX.type?new c.AutoScaleAxis(c.Axis.units.x, b.normalized.series, o, c.extend({}, a.axisX,{highLow:d, referenceValue:0})):a.axisX.type.call(c, c.Axis.units.x, b.normalized.series, o, c.extend({}, a.axisX,{highLow:d, referenceValue:0})), l=n=void 0===a.axisY.type?new c.StepAxis(c.Axis.units.y, b.normalized.series, o,{ticks:k}):a.axisY.type.call(c, c.Axis.units.y, b.normalized.series, o, a.axisY)) var p