+
+ /* Skip the current token */
+ NextTok ();
+}
+
+
+
+static void FuncRight (void)
+/* Handle the .RIGHT function */
+{
+ long Count;
+ TokList* List;
+
+ /* Skip it */
+ NextTok ();
+
+ /* Left paren expected */
+ ConsumeLParen ();
+
+ /* Count argument */
+ Count = ConstExpression ();
+ if (Count < 0 || Count > 100) {
+ Error (ERR_RANGE);
+ Count = 1;
+ }
+ ConsumeComma ();
+
+ /* Read the complete token list */
+ List = CollectTokens (0, 9999);
+
+ /* Delete tokens from the list until Count tokens are remaining */
+ while (List->Count > (unsigned) Count) {
+ /* Get the first node */
+ TokNode* T = List->Root;
+
+ /* Remove it from the list */
+ List->Root = List->Root->Next;
+
+ /* Free the node */
+ FreeTokNode (T);
+
+ /* Corrent the token counter */
+ List->Count--;
+ }
+
+ /* Since we want to insert the list before the now current token, we have
+ * to save the current token in some way and then skip it. To do this, we
+ * will add the current token at the end of the token list (so the list
+ * will never be empty), push the token list, and then skip the current
+ * token. This will replace the current token by the first token from the
+ * list (which will be the old current token in case the list was empty).
+ */
+ AddCurTok (List);
+
+ /* Insert it into the scanner feed */
+ PushTokList (List, ".RIGHT");
+
+ /* Skip the current token */
+ NextTok ();