// The Nova Project by Ken Beckett. // Copyright (C) 2007-2012 Inevitable Software, all rights reserved. // Released under the Common Development and Distribution License, CDDL-1.0: http://opensource.org/licenses/cddl1.php using Nova.Parsing; using Nova.Rendering; namespace Nova.CodeDOM { /// <summary> /// The common base class of <see cref="DefineSymbol"/> and <see cref="UnDefSymbol"/>. /// </summary> public abstract class SymbolDirective : CompilerDirective { #region /* FIELDS */ protected string _symbol; #endregion #region /* CONSTRUCTORS */ protected SymbolDirective(string symbol) { _symbol = symbol; } #endregion #region /* PROPERTIES */ /// <summary> /// The associated symbol name. /// </summary> public string Symbol { get { return _symbol; } set { _symbol = value; } } #endregion #region /* PARSING */ protected SymbolDirective(Parser parser, CodeObject parent) : base(parser, parent) { } protected void ParseSymbol(Parser parser) { Token token = parser.NextTokenSameLine(false); // Move past directive keyword if (token != null) { _symbol = parser.TokenText; // Parse symbol name parser.NextToken(); // Move past name } } #endregion #region /* RENDERING */ protected override void AsTextArgument(CodeWriter writer, RenderFlags flags) { writer.Write(_symbol); } #endregion } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Common Development and Distribution License (CDDL)