<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Fehlende Zeichen]]></title><description><![CDATA[<p>Ich hab ein Problem und zwar passiert es das Zeichen nicht ausgegeben werden. Oder gar überhaupt nicht ankommen.</p>
<pre><code>Eingabe: &quot;class a {public:   function hello(){    console.log(&quot;hello&quot;);  }};class b {public:  function bye(){   
  console.log(&quot;bye&quot;);  }};class c : public a,b{public:  function greet(){    console.log(&quot;greet&quot;);  }}&quot;
</code></pre>
<pre><code>prototypestring{thisfunctionhello){consolestring(&quot;hello);}};prototypestring{thisfunctionbye){consolestring(&quot;bye);}};
prototypestring:thisstring,string{thisfunctiongreet){consolestring(&quot;greet);}}
</code></pre>
<p>Wie was übersetzt wird ist grade mal ziemlich Lachs. Problem ist bei dem &quot;hello&quot; zu erkennen. Oben in der Eingabe ist es in &quot;&quot; unten bei der Ausgabe ist nur das erste &quot; vorhanden soll aber auch das hinter &quot; da sein.</p>
<pre><code>Token Scanner::getNextToken(){  
  std::string buf;
  skipSpaces();                          //to skip chars which are not used
  switch(myCh){
    case '(':
      readNextChar();
       Trans.push_back('(');
      return Token(TT_LBRACKET);
    case ')':
      readNextChar();
      Trans.push_back(')');
      return Token(TT_RBRACKET);
    case '}':
      readNextChar();
      Trans.push_back('}');
      return Token(TT_RBRACE);
    case '{':
      readNextChar();
      Trans.push_back('{');
      return Token(TT_LBRACE);
    case ',':
      readNextChar();
      Trans.push_back(',');
      return Token(TT_COMMA);
    case ';':
      readNextChar();
      Trans.push_back(';');
      return Token(TT_SEMI);
    case ':':
      readNextChar();
      Trans.push_back(':');
      return Token(TT_COLON);
    case '.':
      readNextChar();
      Trans.push_back('.');
      return Token(TT_DOT);
    case '&quot;':
      readNextChar();
       Trans.push_back('&quot;');
      return Token(TT_QUOTE);
                                        //read as long its a letter
    case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm':
 case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': 
     while(isalpha(myCh)){
	buf += myCh;   
	readNextChar();
 	char Sel(myCh);
	if(buf == &quot;class&quot;){
	  buf += myCh;
	  readNextChar();   
 	  std::copy(&quot;prototype&quot;,&quot;prototype&quot;+9,std::back_inserter(Trans));
 /* Problem tritt immer nach diesen aufrufen statt +10 
hilft dort auch nicht 
Allerdings klappt es auch nicht wenn ich diese raus nehme und 
einfach stumpf nur ein zeichen return*/
	  return Token(TT_CLASS);
	}
	if(buf == &quot;function&quot;){
	  buf += myCh;
	  readNextChar();    
 	  std::copy(&quot;function&quot;,&quot;function&quot;+8,std::back_inserter(Trans)); //
	  return Token(TT_FUNC);
	}
	if(buf == &quot;public&quot;){
	  buf += myCh;
	  readNextChar();   
 	  std::copy(&quot;this&quot;,&quot;this&quot;+4,std::back_inserter(Trans));//
	  return Token(TT_PUBLIC);
	}
	if(buf == &quot;hello&quot;){
	  buf += myCh; 
 	  std::copy(&quot;hello&quot;,&quot;hello&quot;+5,std::back_inserter(Trans));//
	  readNextChar(); 
	  return Token(TT_HELLO);
	}
	if(buf == &quot;bye&quot;){
	  buf += myCh;
	  readNextChar();   
 	  std::copy(&quot;bye&quot;,&quot;bye&quot;+3,std::back_inserter(Trans));//
	  return Token(TT_BYE);
	}
	if(buf == &quot;greet&quot;){
	  buf += myCh;
	  readNextChar();   
 	  std::copy(&quot;greet&quot;,&quot;greet&quot;+5,std::back_inserter(Trans));//
	  return Token(TT_GREET);
	}
	if(buf == &quot;console&quot;){
	  buf += myCh; 
	  readNextChar();   
 	  std::copy(&quot;console&quot;,&quot;console&quot;+7,std::back_inserter(Trans));//
	  return Token(TT_CONS);
	}
      }   
      std::copy(&quot;string&quot;,&quot;string&quot;+6,std::back_inserter(Trans));//
      return Token(TT_STRING);

    default:
      if(myCh != 0){
	std::cerr &lt;&lt; &quot;Error: not used Char '&quot; &lt;&lt; myCh &lt;&lt; &quot;'&quot; &lt;&lt; std::endl;
      }      
      break;
  }  
  return Token(TT_NIL);
};
</code></pre>
<pre><code>#ifndef OOPJS_H
#define OOPJS_H

#include &lt;iostream&gt; 
#include &lt;string&gt; 
#include &lt;vector&gt;
#include &lt;map&gt;

enum TokenType{                           // token definition
  TT_LBRACKET,
  TT_RBRACKET,
  TT_LBRACE,
  TT_RBRACE,
  TT_COMMA,
  TT_SEMI,
  TT_COLON,
  TT_DOT,
  TT_PUBLIC,
  TT_FUNC,
  TT_CONS,
  TT_QUOTE,
  TT_STRING,
  TT_CLASS,
  TT_HELLO,
  TT_BYE,
  TT_GREET,
  TT_NIL
};

static const char *TokenTypStr[] = {     // for error message
  &quot;TT_LBRACKET&quot;,
  &quot;TT_RBRACKET&quot;,
  &quot;TT_LBRACE&quot;,
  &quot;TT_RBRACE&quot;,
  &quot;TT_COMMA&quot;,
  &quot;TT_SEMI&quot;,
  &quot;TT_COLON&quot;,
  &quot;TT_DOT&quot;,
  &quot;TT_PUBLIC&quot;,
  &quot;TT_FUNC&quot;,
  &quot;TT_CONS&quot;,
  &quot;TT_QUOTE&quot;,
  &quot;TT_STRING&quot;,
  &quot;TT_CLASS&quot;,
  &quot;TT_HELLO&quot;,
  &quot;TT_BYE&quot;,
  &quot;TT_GREET&quot;,
  &quot;TT_NIL&quot;
};

class Token{
public:
  Token(TokenType type = TT_NIL, int value = 0);
  TokenType getType() const { return myType; }
  int getValue() const { return myValue; }
  const char *toString() const { return TokenTypStr[myType]; }  // error message
  bool equal(TokenType type) const { return myType == type; }         //comparison
private:
  TokenType myType;
  int myValue;
};

class Scanner{
public:
  void veci();
  void veci2();  
  Scanner(const std::string&amp; input);
  Token getNextToken();
  void TranslateVeci();
private:
//  std::map&lt;TokenType, char&gt; Save;
  std::vector&lt;char&gt; Trans;
  std::string myInput;
  unsigned int myPos;                                            //Position at input
  char myCh;                                                     //last char
  void skipSpaces();
  void readNextChar();
};

#endif
</code></pre>
<pre><code>#include &lt;iostream&gt; 
#include &lt;fstream&gt;
#include &lt;string&gt; 
#include &quot;oopjs.h&quot; 

int main(){  
  std::ifstream open(&quot;../testunits/test.js&quot;);
  if(!open){
    std::cerr &lt;&lt; &quot;not open&quot; &lt;&lt; std::endl;
  }
  std::string input;
  std::string save;
  while(!open.eof()){ 
    getline(open,save);
    input.append(save);
  }
  std::cout &lt;&lt; &quot;Eingabe: \&quot;&quot; &lt;&lt; input &lt;&lt; &quot;\&quot;\n&quot; &lt;&lt; std::endl; 
  Scanner scanner(input); 
  Token tok = scanner.getNextToken(); 
  while (!tok.equal(TT_NIL)){ 
    std::cout &lt;&lt; tok.toString() &lt;&lt; &quot; = &quot; &lt;&lt; tok.getValue() &lt;&lt; std::endl; 
    tok = scanner.getNextToken(); 
  } 
  scanner.veci2();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/310218/fehlende-zeichen</link><generator>RSS for Node</generator><lastBuildDate>Tue, 04 Aug 2026 21:19:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/310218.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 06 Nov 2012 14:50:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Fehlende Zeichen on Tue, 06 Nov 2012 14:51:23 GMT]]></title><description><![CDATA[<p>Ich hab ein Problem und zwar passiert es das Zeichen nicht ausgegeben werden. Oder gar überhaupt nicht ankommen.</p>
<pre><code>Eingabe: &quot;class a {public:   function hello(){    console.log(&quot;hello&quot;);  }};class b {public:  function bye(){   
  console.log(&quot;bye&quot;);  }};class c : public a,b{public:  function greet(){    console.log(&quot;greet&quot;);  }}&quot;
</code></pre>
<pre><code>prototypestring{thisfunctionhello){consolestring(&quot;hello);}};prototypestring{thisfunctionbye){consolestring(&quot;bye);}};
prototypestring:thisstring,string{thisfunctiongreet){consolestring(&quot;greet);}}
</code></pre>
<p>Wie was übersetzt wird ist grade mal ziemlich Lachs. Problem ist bei dem &quot;hello&quot; zu erkennen. Oben in der Eingabe ist es in &quot;&quot; unten bei der Ausgabe ist nur das erste &quot; vorhanden soll aber auch das hinter &quot; da sein.</p>
<pre><code>Token Scanner::getNextToken(){  
  std::string buf;
  skipSpaces();                          //to skip chars which are not used
  switch(myCh){
    case '(':
      readNextChar();
       Trans.push_back('(');
      return Token(TT_LBRACKET);
    case ')':
      readNextChar();
      Trans.push_back(')');
      return Token(TT_RBRACKET);
    case '}':
      readNextChar();
      Trans.push_back('}');
      return Token(TT_RBRACE);
    case '{':
      readNextChar();
      Trans.push_back('{');
      return Token(TT_LBRACE);
    case ',':
      readNextChar();
      Trans.push_back(',');
      return Token(TT_COMMA);
    case ';':
      readNextChar();
      Trans.push_back(';');
      return Token(TT_SEMI);
    case ':':
      readNextChar();
      Trans.push_back(':');
      return Token(TT_COLON);
    case '.':
      readNextChar();
      Trans.push_back('.');
      return Token(TT_DOT);
    case '&quot;':
      readNextChar();
       Trans.push_back('&quot;');
      return Token(TT_QUOTE);
                                        //read as long its a letter
    case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm':
 case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': 
     while(isalpha(myCh)){
	buf += myCh;   
	readNextChar();
 	char Sel(myCh);
	if(buf == &quot;class&quot;){
	  buf += myCh;
	  readNextChar();   
 	  std::copy(&quot;prototype&quot;,&quot;prototype&quot;+9,std::back_inserter(Trans));
 /* Problem tritt immer nach diesen aufrufen statt +10 
hilft dort auch nicht 
Allerdings klappt es auch nicht wenn ich diese raus nehme und 
einfach stumpf nur ein zeichen return*/
	  return Token(TT_CLASS);
	}
	if(buf == &quot;function&quot;){
	  buf += myCh;
	  readNextChar();    
 	  std::copy(&quot;function&quot;,&quot;function&quot;+8,std::back_inserter(Trans)); //
	  return Token(TT_FUNC);
	}
	if(buf == &quot;public&quot;){
	  buf += myCh;
	  readNextChar();   
 	  std::copy(&quot;this&quot;,&quot;this&quot;+4,std::back_inserter(Trans));//
	  return Token(TT_PUBLIC);
	}
	if(buf == &quot;hello&quot;){
	  buf += myCh; 
 	  std::copy(&quot;hello&quot;,&quot;hello&quot;+5,std::back_inserter(Trans));//
	  readNextChar(); 
	  return Token(TT_HELLO);
	}
	if(buf == &quot;bye&quot;){
	  buf += myCh;
	  readNextChar();   
 	  std::copy(&quot;bye&quot;,&quot;bye&quot;+3,std::back_inserter(Trans));//
	  return Token(TT_BYE);
	}
	if(buf == &quot;greet&quot;){
	  buf += myCh;
	  readNextChar();   
 	  std::copy(&quot;greet&quot;,&quot;greet&quot;+5,std::back_inserter(Trans));//
	  return Token(TT_GREET);
	}
	if(buf == &quot;console&quot;){
	  buf += myCh; 
	  readNextChar();   
 	  std::copy(&quot;console&quot;,&quot;console&quot;+7,std::back_inserter(Trans));//
	  return Token(TT_CONS);
	}
      }   
      std::copy(&quot;string&quot;,&quot;string&quot;+6,std::back_inserter(Trans));//
      return Token(TT_STRING);

    default:
      if(myCh != 0){
	std::cerr &lt;&lt; &quot;Error: not used Char '&quot; &lt;&lt; myCh &lt;&lt; &quot;'&quot; &lt;&lt; std::endl;
      }      
      break;
  }  
  return Token(TT_NIL);
};
</code></pre>
<pre><code>#ifndef OOPJS_H
#define OOPJS_H

#include &lt;iostream&gt; 
#include &lt;string&gt; 
#include &lt;vector&gt;
#include &lt;map&gt;

enum TokenType{                           // token definition
  TT_LBRACKET,
  TT_RBRACKET,
  TT_LBRACE,
  TT_RBRACE,
  TT_COMMA,
  TT_SEMI,
  TT_COLON,
  TT_DOT,
  TT_PUBLIC,
  TT_FUNC,
  TT_CONS,
  TT_QUOTE,
  TT_STRING,
  TT_CLASS,
  TT_HELLO,
  TT_BYE,
  TT_GREET,
  TT_NIL
};

static const char *TokenTypStr[] = {     // for error message
  &quot;TT_LBRACKET&quot;,
  &quot;TT_RBRACKET&quot;,
  &quot;TT_LBRACE&quot;,
  &quot;TT_RBRACE&quot;,
  &quot;TT_COMMA&quot;,
  &quot;TT_SEMI&quot;,
  &quot;TT_COLON&quot;,
  &quot;TT_DOT&quot;,
  &quot;TT_PUBLIC&quot;,
  &quot;TT_FUNC&quot;,
  &quot;TT_CONS&quot;,
  &quot;TT_QUOTE&quot;,
  &quot;TT_STRING&quot;,
  &quot;TT_CLASS&quot;,
  &quot;TT_HELLO&quot;,
  &quot;TT_BYE&quot;,
  &quot;TT_GREET&quot;,
  &quot;TT_NIL&quot;
};

class Token{
public:
  Token(TokenType type = TT_NIL, int value = 0);
  TokenType getType() const { return myType; }
  int getValue() const { return myValue; }
  const char *toString() const { return TokenTypStr[myType]; }  // error message
  bool equal(TokenType type) const { return myType == type; }         //comparison
private:
  TokenType myType;
  int myValue;
};

class Scanner{
public:
  void veci();
  void veci2();  
  Scanner(const std::string&amp; input);
  Token getNextToken();
  void TranslateVeci();
private:
//  std::map&lt;TokenType, char&gt; Save;
  std::vector&lt;char&gt; Trans;
  std::string myInput;
  unsigned int myPos;                                            //Position at input
  char myCh;                                                     //last char
  void skipSpaces();
  void readNextChar();
};

#endif
</code></pre>
<pre><code>#include &lt;iostream&gt; 
#include &lt;fstream&gt;
#include &lt;string&gt; 
#include &quot;oopjs.h&quot; 

int main(){  
  std::ifstream open(&quot;../testunits/test.js&quot;);
  if(!open){
    std::cerr &lt;&lt; &quot;not open&quot; &lt;&lt; std::endl;
  }
  std::string input;
  std::string save;
  while(!open.eof()){ 
    getline(open,save);
    input.append(save);
  }
  std::cout &lt;&lt; &quot;Eingabe: \&quot;&quot; &lt;&lt; input &lt;&lt; &quot;\&quot;\n&quot; &lt;&lt; std::endl; 
  Scanner scanner(input); 
  Token tok = scanner.getNextToken(); 
  while (!tok.equal(TT_NIL)){ 
    std::cout &lt;&lt; tok.toString() &lt;&lt; &quot; = &quot; &lt;&lt; tok.getValue() &lt;&lt; std::endl; 
    tok = scanner.getNextToken(); 
  } 
  scanner.veci2();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2268172</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268172</guid><dc:creator><![CDATA[Enno]]></dc:creator><pubDate>Tue, 06 Nov 2012 14:51:23 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlende Zeichen on Tue, 06 Nov 2012 15:09:18 GMT]]></title><description><![CDATA[<p>Diese Sequenz in Zeile 51:</p>
<pre><code>std::copy(&quot;prototype&quot;,&quot;prototype&quot;+9,std::back_inserter(Trans));
 /* Problem tritt immer nach diesen aufrufen statt +10
hilft dort auch nicht
Allerdings klappt es auch nicht wenn ich diese raus nehme und
einfach stumpf nur ein zeichen return*/
</code></pre>
<p>erzeugt ein undefiniertes Verhalten. Die beiden Strings &quot;prototype&quot; sind verschieden, auch wenn sie den selben Inhalt haben.</p>
<p>Besser:</p>
<pre><code>const char* prototype_str = &quot;prototype&quot;;
std::copy( prototype_str, prototype_str + std::char_traits&lt; char &gt;::length( prototype_str ), std::back_inserter(Trans) );
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2268180</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268180</guid><dc:creator><![CDATA[Werner_logoff]]></dc:creator><pubDate>Tue, 06 Nov 2012 15:09:18 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlende Zeichen on Tue, 06 Nov 2012 15:33:51 GMT]]></title><description><![CDATA[<p>Werner_logoff schrieb:</p>
<blockquote>
<p>Diese Sequenz in Zeile 51:</p>
<pre><code>std::copy(&quot;prototype&quot;,&quot;prototype&quot;+9,std::back_inserter(Trans));
 /* Problem tritt immer nach diesen aufrufen statt +10
hilft dort auch nicht
Allerdings klappt es auch nicht wenn ich diese raus nehme und
einfach stumpf nur ein zeichen return*/
</code></pre>
<p>erzeugt ein undefiniertes Verhalten. Die beiden Strings &quot;prototype&quot; sind verschieden, auch wenn sie den selben Inhalt haben.</p>
<p>Besser:</p>
<pre><code>const char* prototype_str = &quot;prototype&quot;;
std::copy( prototype_str, prototype_str + std::char_traits&lt; char &gt;::length( prototype_str ), std::back_inserter(Trans) );
</code></pre>
</blockquote>
<p>Sehr guter Tipp danke.<br />
Allerdings ändert das nichts.<br />
Vielleicht sollte ich noch erwähnen das es genau so wie es ist funktioniert HAT. Allerdings kam dann 3-4 mal beim compilieren ein Fehler und ich habe NICHTS geändert. Auf einmal funktioniert es wieder und es fehlen Zeichen. Das klingt irgendwie komisch. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /> Ich werde noch mal eine neue Datei machen und es dort rein schreiben vielleicht hilft dies. So viel schon damit rum probiert. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268186</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268186</guid><dc:creator><![CDATA[Enno]]></dc:creator><pubDate>Tue, 06 Nov 2012 15:33:51 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlende Zeichen on Tue, 06 Nov 2012 15:54:34 GMT]]></title><description><![CDATA[<p>Du musst diese Änderung für alle Aufrufe vornehmen, die so aufgebaut sind.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268192</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268192</guid><dc:creator><![CDATA[ghjghj]]></dc:creator><pubDate>Tue, 06 Nov 2012 15:54:34 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlende Zeichen on Tue, 06 Nov 2012 16:06:23 GMT]]></title><description><![CDATA[<p>ghjghj schrieb:</p>
<blockquote>
<p>Du musst diese Änderung für alle Aufrufe vornehmen, die so aufgebaut sind.</p>
</blockquote>
<p>Bringt nichts.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268198</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268198</guid><dc:creator><![CDATA[Enno]]></dc:creator><pubDate>Tue, 06 Nov 2012 16:06:23 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlende Zeichen on Tue, 06 Nov 2012 16:12:46 GMT]]></title><description><![CDATA[<p>Vermutlich liest du beim Einlesen von class, hello, usw. am Ende ein Zeichen zu viel ein und es geht daher verloren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268201</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268201</guid><dc:creator><![CDATA[fghfghfgh]]></dc:creator><pubDate>Tue, 06 Nov 2012 16:12:46 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlende Zeichen on Tue, 06 Nov 2012 16:16:13 GMT]]></title><description><![CDATA[<p>fghfghfgh schrieb:</p>
<blockquote>
<p>Vermutlich liest du beim Einlesen von class, hello, usw. am Ende ein Zeichen zu viel ein und es geht daher verloren.</p>
</blockquote>
<p>Das hello Token ist nicht das Problem sonder oben die Zeichen Token( &quot; . : ; () {} ). Die gehen verloren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268203</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268203</guid><dc:creator><![CDATA[Enno]]></dc:creator><pubDate>Tue, 06 Nov 2012 16:16:13 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlende Zeichen on Tue, 06 Nov 2012 17:22:52 GMT]]></title><description><![CDATA[<p>Enno schrieb:</p>
<blockquote>
<p>Das hello Token ist nicht das Problem sonder oben die Zeichen Token( &quot; . : ; () {} ). Die gehen verloren.</p>
</blockquote>
<p>doch ist es:</p>
<pre><code>if(buf == &quot;hello&quot;){ 
  buf += myCh; 
  std::copy(&quot;hello&quot;,&quot;hello&quot;+5,std::back_inserter(Trans));// 
  readNextChar(); 
  return Token(TT_HELLO); 
}
</code></pre>
<p>hier ignorierst du das erste zeichen nach hello (welches gerade in myCh steht)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268258</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268258</guid><dc:creator><![CDATA[hello]]></dc:creator><pubDate>Tue, 06 Nov 2012 17:22:52 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlende Zeichen on Wed, 07 Nov 2012 09:13:08 GMT]]></title><description><![CDATA[<p>hello schrieb:</p>
<blockquote>
<p>Enno schrieb:</p>
<blockquote>
<p>Das hello Token ist nicht das Problem sonder oben die Zeichen Token( &quot; . : ; () {} ). Die gehen verloren.</p>
</blockquote>
<p>doch ist es:</p>
<pre><code>if(buf == &quot;hello&quot;){ 
  buf += myCh; 
  std::copy(&quot;hello&quot;,&quot;hello&quot;+5,std::back_inserter(Trans));// 
  readNextChar(); 
  return Token(TT_HELLO); 
}
</code></pre>
<p>hier ignorierst du das erste zeichen nach hello (welches gerade in myCh steht)</p>
</blockquote>
<p>Könntest du das vielleicht noch einmal genauer sagen?<br />
Oh hab es. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<pre><code>if(buf == &quot;hello&quot;){ 
  std::copy( hello_str, hello_str + std::char_traits&lt; char &gt;::length( hello_str ), std::back_inserter(Trans) );  
  return Token(TT_HELLO); 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2268456</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268456</guid><dc:creator><![CDATA[Enno]]></dc:creator><pubDate>Wed, 07 Nov 2012 09:13:08 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlende Zeichen on Wed, 07 Nov 2012 11:35:01 GMT]]></title><description><![CDATA[<p>Für diese Text-Tokens solltest du wirklich eine std::map o. ä. nutzen.</p>
<pre><code>theMap[&quot;public&quot;] = TT_PUBLIC;
theMap[&quot;class&quot;] = TT_CLASS;

if (theMap.find(buf) != theMap.end())
{
 std::copy(theMap[buf].second.begin(), theMap[buf].second.end(), std::back_inserter(Trans))

 return Token(theMap[buf].first);
}
</code></pre>
<p>Ungetestet und ohne größere Überlegung dahingeschrieben, es geht einfach um das Prinzip...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268504</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268504</guid><dc:creator><![CDATA[hjkhjk]]></dc:creator><pubDate>Wed, 07 Nov 2012 11:35:01 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlende Zeichen on Wed, 07 Nov 2012 11:40:02 GMT]]></title><description><![CDATA[<p>hjkhjk schrieb:</p>
<blockquote>
<p>Für diese Text-Tokens solltest du wirklich eine std::map o. ä. nutzen.</p>
<pre><code>theMap[&quot;public&quot;] = TT_PUBLIC;
theMap[&quot;class&quot;] = TT_CLASS;

if (theMap.find(buf) != theMap.end())
{
 std::copy(theMap[buf].second.begin(), theMap[buf].second.end(), std::back_inserter(Trans))

 return Token(theMap[buf].first);
}
</code></pre>
<p>Ungetestet und ohne größere Überlegung dahingeschrieben, es geht einfach um das Prinzip...</p>
</blockquote>
<p>Danke für die Anregung, schau ich mir mal an und guck ob draus was wird.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268505</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268505</guid><dc:creator><![CDATA[Enno]]></dc:creator><pubDate>Wed, 07 Nov 2012 11:40:02 GMT</pubDate></item></channel></rss>