473,779 Members | 2,035 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

about CSharp Parser

Hi:
I work in Csharp's parser files by LEX/YACC.Now I have only CSharp-lex.l
and CSharp.y file,but they not have CSharp'comment Parse. this is a part of
CSharp-lex.l.

............... ......
/***** Comments *****/
"/*" { yy_push_state(I N_COMMENT); }
<IN_COMMENT>. { ; /* ignore */ }
<IN_COMMENT>\ n { ; /* ignore */ }
<IN_COMMENT>" */" { yy_pop_state(); }

{single_line_co mment} { ; /* ignore */ }
............... ....

CSharp.y file not have any more comment regular.

Now I need comment parser in CSharp-lex.l. and CSharp.y files. Who give me
the files?

THS
EKEY
05.1.31

Nov 16 '05 #1
2 4553
go****@wain-sh.com wrote:
/***** Comments *****/
"/*" { yy_push_state(I N_COMMENT); }
<IN_COMMENT>. { ; /* ignore */ }
<IN_COMMENT>\ n { ; /* ignore */ }
<IN_COMMENT>" */" { yy_pop_state(); }

{single_line_co mment} { ; /* ignore */ }

I'm afraid I didn't understand your question, but the above snippet is using
lex start conditions to parse C-style comments, as used in C#. You can read
more about them here:

http://www.gnu.org/software/flex/man..._11.html#SEC11

On this page you will also find a much more efficient snippet of code for
parsing the same thing:

"/*" BEGIN(comment);

<comment>[^*\n]* /* eat anything that's not a '*' */
<comment>"*"+[^*/\n]* /* eat up '*'s not followed by '/'s */
<comment>\n ++line_num;
<comment>"*"+ "/" BEGIN(INITIAL);

It's more efficient because it "eats" large strings of comment characters,
instead of eating one character at a time. You would simply add it somewhere
in your .y file. (line_num is assumed to be an integer variable tracking the
current line number). I hope this helps.
--
Derrick Coetzee, Microsoft Speech Server developer
This posting is provided "AS IS" with no warranties, and confers no rights.
Nov 16 '05 #2

If you look for a C# parser, try
http://www.c-sharpcorner.com/Code/20...CodeParser.asp

Lionel.

"news.microsoft .com" <go****@wain-sh.com> a ecrit dans le message de news:
ez************* *@TK2MSFTNGP15. phx.gbl...
Hi:
I work in Csharp's parser files by LEX/YACC.Now I have only
CSharp-lex.l
and CSharp.y file,but they not have CSharp'comment Parse. this is a part
of
CSharp-lex.l.

............... .....
/***** Comments *****/
"/*" { yy_push_state(I N_COMMENT); }
<IN_COMMENT>. { ; /* ignore */ }
<IN_COMMENT>\ n { ; /* ignore */ }
<IN_COMMENT>" */" { yy_pop_state(); }

{single_line_co mment} { ; /* ignore */ }
............... ...

CSharp.y file not have any more comment regular.

Now I need comment parser in CSharp-lex.l. and CSharp.y files. Who give me
the files?

THS
EKEY
05.1.31

Nov 16 '05 #3

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

Similar topics

1
5286
by: Karalius, Joseph | last post by:
Can anyone explain what is happening here? I haven't found any useful info on Google yet. Thanks in advance. mmagnet:/home/jkaralius/src/zopeplone/Python-2.3.5 # make gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I. -I./Include -DPy_BUILD_CORE -o Modules/python.o Modules/python.c gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I. -I./Include -DPy_BUILD_CORE -o...
0
1453
by: Bekkali Hicham | last post by:
Hi, i am using WSAD 4.0.2 java perspective to devellop a XMLEditor (read only), i use the SAX api for this purpose, everything works fine, i succed to create a JTree representation of an xml file, but when i choose to open a non-well-formed xml file,i receive the event DefaultHandler.fatalError(SAXParseException), but when i want to open an invalide-xml file (with an incorporated dtd) the parser don't send any information, evenif i have...
2
2887
by: Ken Philips | last post by:
As far as I know the Schema Object Model (SOM) is only working for the MSXML Parser together with CSharp or VisualBasic but not Java. Is there a similar Tool/Spec/Api for the Java World? Ken
6
4351
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing result in any way. Who can help me, I thank you very very much. list.cpp(main program) //-------------------------------------------------------------------------- - #pragma hdrstop #pragma argsused
19
2027
by: Gérard Talbot | last post by:
posted to: alt.html and comp.infosystems.www.authoring.html followup-to: comp.infosystems.www.authoring.html Hello all, I have 2 questions about validations. 1- What's basically the difference between - validation, validity - well-formedness
5
1297
by: EMonaco | last post by:
All, I have a simple C# window app under MyApp namespace it has a class Form1. I've added another class .cs file. Now this class I want to share with many projects, so I figured I'd change this class.cs file from namespace MyApp Class MyClass
10
2264
by: sp | last post by:
I create an xml file in a text editor: <?xml version="1.0" encoding="utf-8"?> <elts> <elt id="1" class="c1">content1</elt> <elt id="2" class="c1">content2</elt> </elts> Then I load the file via xmlHttpRequest into xmlData variable. Why does xmlData.getElementById('1') return null and xmlData.firstChild.childNodes.className returns null also?
5
10647
by: Joel | last post by:
In the course of my project, I must include some custom logic and would like to integrate a small script language in my application for that purpose. In C++, I used the LUA script language and I know that bindings exists for a LUA/c# integration, but only using the binary DLL. However, I would prefer a native c# solution and for a small language, not a huge interpreter like Python. Has anybody seen such implementation ? Thanks,
3
1523
by: Steven W. Orr | last post by:
I decided I could be more articulate. I hope this helps. I'm writing a program that needs to process options. Due to the nature of the program with its large number of commandline options, I would like to write a callback to be set inside add_option. Something like this: parser.add_option("-b", action="callback", callback=optionhandlr, dest='b')
0
9632
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10136
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10071
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9925
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8958
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7478
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5501
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2867
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.