?login_element?

Subversion Repositories NedoOS

Rev

Rev 539 | Blame | Compare with Previous | Last modification | View Log | Download

  1. /*
  2.  
  3.   SjASMPlus Z80 Cross Compiler
  4.  
  5.   This is modified sources of SjASM by Aprisobal - aprisobal@tut.by
  6.  
  7.   Copyright (c) 2005 Sjoerd Mastijn
  8.  
  9.   This software is provided 'as-is', without any express or implied warranty.
  10.   In no event will the authors be held liable for any damages arising from the
  11.   use of this software.
  12.  
  13.   Permission is granted to anyone to use this software for any purpose,
  14.   including commercial applications, and to alter it and redistribute it freely,
  15.   subject to the following restrictions:
  16.  
  17.   1. The origin of this software must not be misrepresented; you must not claim
  18.          that you wrote the original software. If you use this software in a product,
  19.          an acknowledgment in the product documentation would be appreciated but is
  20.          not required.
  21.  
  22.   2. Altered source versions must be plainly marked as such, and must not be
  23.          misrepresented as being the original software.
  24.  
  25.   3. This notice may not be removed or altered from any source distribution.
  26.  
  27. */
  28.  
  29. // parser.h
  30.  
  31. int ParseExpression(char*& lp, aint& val);
  32. int ParseExpressionNoSyntaxError(char*& lp, aint& val);
  33.  
  34. // returns 0 on syntax error, 1 on expression which is not enclosed in parentheses
  35. // 2 when whole expression is in [] or () (--syntax=b/B affects when "2" is reported)
  36. int ParseExpressionMemAccess(char*& p, aint& nval);
  37.  
  38. void ParseAlignArguments(char* & src, aint & alignment, aint & fill);
  39. int ParseDirective(bool beginningOfLine = 0);
  40. int ParseDirective_REPT();
  41. void ParseInstruction();
  42. char* ReplaceDefine(char* lp);
  43. void SetLastParsedLabel(const char* label);
  44. int PrepareLine();              // initial part of ParseLine, before the actual content parsing logic starts
  45.  
  46. /**
  47.  * @brief Reads and prepares for parsing new lines until non-blank char is encountered (producing
  48.  * listing file along).
  49.  *
  50.  * WARNING - this is pushing slightly beyond the original architecture of SjASMPlus, affecting
  51.  * global state like `lp, line, ...`, so it's *NOT* possible to "roll-back" from this step, this
  52.  * is one-way ticket in terms of lines parsing.
  53.  *
  54.  * @param p parsing pointer (will be adjusted for new line read)
  55.  * @return bool false when no more lines available, true when non-blank char is ready
  56.  */
  57. bool PrepareNonBlankMultiLine(char*& p);
  58.  
  59. void ParseLine(bool parselabels = true);
  60. void ParseLineSafe(bool parselabels = true);
  61. void ParseStructLine(CStructure* st);
  62.  
  63. template <int argsN> bool getIntArguments(char*& lp, aint (&args)[argsN], const bool (&argOptional)[argsN]) {
  64.         for (int i = 0; i < argsN; ++i) {
  65.                 if (0 < i && !comma(lp)) return argOptional[i];
  66.                 aint val;                               // temporary variable to preserve original value in case of error
  67.                 if (!ParseExpression(lp, val)) return (0 == i) && argOptional[i];
  68.                 args[i] = val;
  69.         }
  70.         return !comma(lp);
  71. }
  72.  
  73. //eof parser.h
  74.