diff options
| author | Felix Salfelder <[email protected]> | 2024-02-20 00:00:00 +0000 |
|---|---|---|
| committer | Felix Salfelder <[email protected]> | 2024-02-20 00:00:00 +0000 |
| commit | 874f2d554b76968c72e749931dbd99444f064f2d (patch) | |
| tree | 27d466b5e2a7ea24216afcf2fae15e0d68badec8 /lib/m_base_in.cc | |
| parent | e71aca4f82722e1b22ca04a23b362d3fedbe0952 (diff) | |
| parent | 97efe32a317c5104280c964a9e2b93ee3875a53c (diff) | |
| download | gnucap-master.tar.gz | |
Diffstat (limited to 'lib/m_base_in.cc')
| -rw-r--r-- | lib/m_base_in.cc | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/lib/m_base_in.cc b/lib/m_base_in.cc index 27e2d110..e39bcc3c 100644 --- a/lib/m_base_in.cc +++ b/lib/m_base_in.cc @@ -60,27 +60,56 @@ void Name_String::parse(CS& File) _data += File.ctoc(); } }else{ - while (File.is_alpha() || File.is_pfloat() || File.match1("_[]")) { + int bracket = 0; + while (true) { + if (File.is_alpha() || File.is_pfloat() || File.match1("_$")) { + }else if (File.match1("[")) { + ++bracket; + }else if (bracket && File.match1("]")) { + --bracket; + }else{ + break; + } _data += File.ctoc(); } + if(bracket){ + File.warn(bDANGER, "missing ]?"); + }else{ + } } File.skipbl(); } /*--------------------------------------------------------------------------*/ +void Angled_String::parse(CS& File) +{ + File.skipbl(); + _data = File.ctos("", "<", ">"); + File.skipbl(); +} +/*--------------------------------------------------------------------------*/ void Quoted_String::parse(CS& File) -{untested(); +{ File.skipbl(); size_t here = File.cursor(); char quote = File.ctoc(); _data = ""; - for (;;) {untested(); - if (File.skip1(quote)) {untested(); + // TODO: extend ctos and use it. + for (;;) { + if (File.match1('\\')) { itested(); + _data += File.ctoc(); + if (File.match1(quote)) { itested(); + _data += File.ctoc(); + }else if (File.match1('\\')) { itested(); + _data += File.ctoc(); + }else{ itested(); + } + }else if (File.skip1(quote)) { break; - }else if (!File.more()) {untested(); - File.warn(0, "end of file in quoted string"); - File.warn(0, here, "string begins here"); + }else if (!File.ns_more()) { + File.warn(bNOERROR, "end of file in quoted string"); + File.warn(bNOERROR, here, "string begins here"); break; - }else{untested(); + }else{ _data += File.ctoc(); } } |
