I'm working on a Boost Spirit 2.0 based parser for a small subset of Fortran 77. The issue I'm having is that Fortran 77 is column oriented, and I have been unable to find anything in Spirit that can allow its parsers to be column-aware. Is there any way to do this?
I don't really have to support the full arcane Fortran syntax, but it d...
I would like to use a parsed value as the input to a loop parser.
The grammar defines a header that specifies the (variable) size of the following string. For example, say the following string is the input to some parser.
12\r\nTest Payload
The parser should extract the 12, convert it to an unsigned int and then read twelve char...
boost::spirit asserts at
boost::spirit::char_class::ascii::isalnum()
when passing ascci characters > 127.
I changed all my private variables from std::string to a
typedef std::basic_string<unsigned char, std::char_traits<unsigned char>, std::allocator<unsigned char> >
u_string;
but still boost uses std:.string internally. Wha...
greetings.
i've been interesting in how to force boost::spirit to produce nodes of different classes when parsing the grammar and generating AST. say, i want to have different nodes such as VariableNode (which has name of variable as its member), ValueNode (which has value as its member), etc.
it would be very useful when dealing with ...
good day.
i've been using boost spirit classic in the past and now i'm trying to stick to the newer one, boost spirit 2.x. could someone be so kind to point me in how to deal with keywords? say, i want to distinguish between "foo" and "int" where "foo" is identifier and "int" is just a keyword. i want to protect my grammar from incorrec...
Could someone please give me some advice/ideas about how to deal with the situations when it's needed to have a look at further declarations to be able to make correct semantic actions on current moment? For example, it is a well-known occurrence when someone writes an interpreter/compiler of some programming language which doesn't suppo...
I've been using spirit classic for quite a while and recently start learning
v2. Both are easy to use and powerful enough to handle moderate parsing
issue.
In those idyllic days with the spirit classic and ascii characters,
the job is simply adapting an EBNF to LL form. But finally, I have to
deal with the i18n.
My thought is rea...
I am planning on doing a script transformation utility (for extended diagnostic information) using Boost.Spirit 2.
While there is support for line information etc. for parsing errors, how i can store line numbers for successfully parsed expressions with Qi?
...
I have figured out how to use spirit -- i.e., I have written a moderately complex grammar. I always take the approach of growing a program -- one subsystem at a time. I've written the data structures for a complex model which has 4 types at the highest level.
I would like to use the grammar composed from rules approach to parse the top...
I have a section of a schema for a model that I need to parse. Lets say it looks like the following.
{
type = "Standard";
hostname="x.y.z";
port="123";
}
The properties are:
The elements may appear unordered.
All elements that are part of the schema must appear, and no other.
All of the elements' synthesised attributes go into...
Hi,
I'm not being able to figure out what's wrong with my code. Boost's templates are making me go crazy! I can't make heads or tails out of all this, so I just had to ask.
What's wrong with this?
#include <iostream>
#include <boost/lambda/lambda.hpp>
#include <boost/spirit/include/qi.hpp>
void parsePathTest(const std::string &path)
...
Is anyone aware of an online resource where I can find out how to write a simple expression parser using Boost::Spirit?.
I do not necessarily need to evaluate the expression, but I need to parse it and be able to return a boolean to indicate whether the expression is parsable or not (e.g. brackets not matching etc).
I need the parser t...
I am using Boost Spirit parser, and as the parser is parsing, semantic actions are reflected to an instance of the class ParserActions.
Here is the code for the parser (the relevant part)
struct urdf_grammar : public grammar<urdf_grammar> {
template <typename ScannerT>
struct definition {
definition(urdf_grammar const& se...
Hello all,
I am using the boost::spirit parser. At one point when I use real_p, the value coming out of the parser stack is 38672000 instead of the actual value, 386731500. Some how it is considering it as a float value, I think. Is there anyway to fix this? Do I need to set the precision of real_p, or am using real_p in the wrong conte...
I have a record parser that throws one of several exceptions to indicate which rule failed.
Front matter:
#include <iostream>
#include <sstream>
#include <stdexcept>
#include <string>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix.hpp>
#include <boost/spirit/include/classic_position_iterator.hpp>
using ...
Shouldn't a simple eol do the trick?
#include <algorithm>
#include <boost/spirit/include/qi.hpp>
#include <iostream>
#include <string>
using boost::spirit::ascii::space;
using boost::spirit::lit;
using boost::spirit::qi::eol;
using boost::spirit::qi::phrase_parse;
struct fix : std::unary_function<char, void> {
fix(std::string &result...
Let's say I have a grammar defined to something like:
some_rule := a b [c [d]]
where c, and d are optional and default to a certain value (let's say 14) if not given. Can I get it to default to the 14 if the value isn't given? I want the produced std::vector to always be of size 4.
The closest I've come is like the following:
qi::ru...
I'm using Boost.Spirit which was distributed with Boost-1.42.0 with VS2005. My problem is like this.
I've this string which was delimted with commas. The first 3 fields of it are strings and rest are numbers. like this.
String1,String2,String3,12.0,12.1,13.0,13.1,12.4
My rule is like this
qi::rule<string::iterator, qi::skip_type> st...
I have redesigned and extended the grammar I asked about earlier as shown below:
// BIFAnalyser.cpp : Defines the entry point for the console application.
//
//
/*=============================================================================
Copyright (c) Temitope Jos Onunkun 2010
http://www.dcs.kcl.ac.uk/pg/onun/
Use, mod...
I've been struggling to try and (incrementally) modify example code from the documentation but with not much different I am not getting the behavior I expect. Specifically, the "if" statement fails when (my intent is that) it should be passing (there was an "else" but that part of the parser was removed during debugging). The assignmen...