Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Need Help for a parser

Need Help for a parser

Scheduled Pinned Locked Moved C#
comjsonhelpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mitko5
    wrote on last edited by
    #1

    I've got some problems parsing strings and /* */ comments. Any help will be appreciated. ----------------- // multyline comments case '*': case '/': case '(': case ')': case '+': case '-': case '=': case '~': case '|': case ';': case '%': case '&': case '{': case '}': case ',': case '[': case ']': case '?': case ':': case '^': case '<': case '>': case '!': case '.': substr += s[i]; i++; { if(i < s.Length && (substr == "/")) { if(i < s.Length && (s[i]== '*')) { do { substr += s[i]; i++; } while (i < s.Length && substr== "*/"); rTB2.Text += "Komentar - " + substr + "\n"; substr = ""; } ----------------- case '"': { do { substr += s[i]; i++; } while (i < s.Length && s[i]!='"'); rTB2.Text += "Tekst - " + substr + "\n"; substr = ""; } brake; ----------------- If someone want, here is a direct link to my code. http://www.geocities.com/puma55555/MyC.zip

    J W 2 Replies Last reply
    0
    • M mitko5

      I've got some problems parsing strings and /* */ comments. Any help will be appreciated. ----------------- // multyline comments case '*': case '/': case '(': case ')': case '+': case '-': case '=': case '~': case '|': case ';': case '%': case '&': case '{': case '}': case ',': case '[': case ']': case '?': case ':': case '^': case '<': case '>': case '!': case '.': substr += s[i]; i++; { if(i < s.Length && (substr == "/")) { if(i < s.Length && (s[i]== '*')) { do { substr += s[i]; i++; } while (i < s.Length && substr== "*/"); rTB2.Text += "Komentar - " + substr + "\n"; substr = ""; } ----------------- case '"': { do { substr += s[i]; i++; } while (i < s.Length && s[i]!='"'); rTB2.Text += "Tekst - " + substr + "\n"; substr = ""; } brake; ----------------- If someone want, here is a direct link to my code. http://www.geocities.com/puma55555/MyC.zip

      J Offline
      J Offline
      Judah Gabriel Himango
      wrote on last edited by
      #2

      Why not just post your problem here? Few are going to take the time to download, unzip, and study your code on their spare time. Just post the problems you're havnig here and we can help you. Also, if you code is in the C or C++ languages (guessing by your zip name), you're in the wrong forum.

      Tech, life, family, faith: Give me a visit. I'm currently blogging about: Lent Revisited The apostle Paul, modernly speaking Judah Himango

      1 Reply Last reply
      0
      • M mitko5

        I've got some problems parsing strings and /* */ comments. Any help will be appreciated. ----------------- // multyline comments case '*': case '/': case '(': case ')': case '+': case '-': case '=': case '~': case '|': case ';': case '%': case '&': case '{': case '}': case ',': case '[': case ']': case '?': case ':': case '^': case '<': case '>': case '!': case '.': substr += s[i]; i++; { if(i < s.Length && (substr == "/")) { if(i < s.Length && (s[i]== '*')) { do { substr += s[i]; i++; } while (i < s.Length && substr== "*/"); rTB2.Text += "Komentar - " + substr + "\n"; substr = ""; } ----------------- case '"': { do { substr += s[i]; i++; } while (i < s.Length && s[i]!='"'); rTB2.Text += "Tekst - " + substr + "\n"; substr = ""; } brake; ----------------- If someone want, here is a direct link to my code. http://www.geocities.com/puma55555/MyC.zip

        W Offline
        W Offline
        Werdna
        wrote on last edited by
        #3

        You might be better off using parser generator tool http://www.antlr.org is a good one. You can look at couple of my examples: http://www.codeproject.com/csharp/stringtokenizer.asp[^] or have a look at http://www.adersoftware.com/index.cfm?page=templateEngine2[^] (library with easy to use hand coded lexer/parser) or http://www.adersoftware.com/index.cfm?page=compilers[^]

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups