473,396 Members | 1,599 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

multiple lines declaration

sam
Hi,

The following multiple lines declaration failed.
How can I declare it in C/C++ syntax?

string regex_parser =
"(go)\ +on\ +\$(\S+) // keyword (1) ext_if (2)
\ +from\ +\$(\S+) // int_net (3)
\ +to\ +\$(\S+) // dest(any) (4)
\ +->\ +\(\$(\S+)\)$";
the error is:
myparser.cpp:9: error: missing terminating " character
myparser.cpp:10: error: stray '\' in program
myparser.cpp:10: error: stray '\' in program
....

where line #9 is "(go)\ +on\ +\$(\S+)"

Thanks
Sam
Jul 23 '05 #1
3 1755
sam wrote:
The following multiple lines declaration failed.
How can I declare it in C/C++ syntax?

string regex_parser =
"(go)\ +on\ +\$(\S+) // keyword (1) ext_if (2)
\ +from\ +\$(\S+) // int_net (3)
\ +to\ +\$(\S+) // dest(any) (4)
\ +->\ +\(\$(\S+)\)$";
the error is:
myparser.cpp:9: error: missing terminating " character
myparser.cpp:10: error: stray '\' in program
myparser.cpp:10: error: stray '\' in program
...

where line #9 is "(go)\ +on\ +\$(\S+)"


String literals shall not contain newline characters. Close
every line with a double quote and the parts will be concatenated:

string regex_parser =
"one part" // some comment
"other part";

V
Jul 23 '05 #2
By the way,
string regex_parser =
"(go)\ +on\ +\$(\S+) // keyword (1) ext_if (2)
\ +from\ +\$(\S+) // int_net (3)
\ +to\ +\$(\S+) // dest(any) (4)
\ +->\ +\(\$(\S+)\)$";


The charactere \ is a escape charactere. You need to write \\ if you
want it to be on the string.
Jul 23 '05 #3
sam
Andre Caldas wrote:
By the way,
string regex_parser =
"(go)\ +on\ +\$(\S+) // keyword (1) ext_if (2)
\ +from\ +\$(\S+) // int_net (3)
\ +to\ +\$(\S+) // dest(any) (4)
\ +->\ +\(\$(\S+)\)$";

The charactere \ is a escape charactere. You need to write \\ if you
want it to be on the string.


I have added " and \ to fix the problem, but still haven't tried a real
example yet. I hope this parser works as it supposed to be.

Thanks
Sam
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: SilverShadow | last post by:
Hello, I'm having trouble with something that may be easily remedied. I use Cantera running on Python. I need to make multiple "Reactor()" objects and have them assigned a different (user...
6
by: Michael Winter | last post by:
The following declaration was posted to a forum: cursor: url('path/some.cur'), hand, pointer, text, default; and I'm having a hard time convincing the poster that it's invalid. First of all,...
9
by: lbj137 | last post by:
I have two files: A.c and B.c. In both files I define a global variable, int xxxx; When I compile with a green hills compiler (and also i think with a GNU compiler) I get no errors or warnings....
9
by: Graham | last post by:
I have been having some fun learning and using the new Controls and methods in .Net 2.0 which will make my life in the future easier and faster. Specifically the new databinding practises and...
4
by: Gregory Gadow | last post by:
I've cobbled together a PrinterClass that takes a text file and dumps it to a printer. The app using is has multiple threads, all of which need access to a shared instance. Can someone point me to...
2
by: pagekb | last post by:
Hello, I'm having some difficulty compiling template classes as containers for other template objects. Specifically, I have a hierarchy of template classes that contain each other. Template...
3
by: Student | last post by:
Hi all, While compiling a program I had this message : tools.o(.data+0x0): multiple definition of `VAR_1' main.o(.data+0x0): first defined here tools.o(.data+0x4): multiple definition of...
1
by: Loading name... | last post by:
hey asp.net 2.0 In my db (sql server 2005) I have a record which consist of multiple lines: "HEY THIS IS A TEST OF MULTIPLE LINES"
7
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.