public CssNode Parse()
		{
			rootNode = new CssNode (new CssToken("stylesheet", CssTokenType.STYLESHEET, 0, 0));
			currentNode = rootNode;
			stylesheet();
			
			return rootNode;
		}
		// Handles AtKeyword Parsing
		private void AtKeyword ()
		{
			acceptElement (CssTokenType.ATKEYWORD);
			currentNode = rootNode.GetLatest ();
			acceptElement (CssTokenType.STRING);
			acceptElement (CssTokenType.SEMICOLON);
			
			currentNode = rootNode;
			return;
		}
		private void RuleSet ()
		{
			CssNode ruleSetNode = new CssNode(new CssToken("ruleset", CssTokenType.RULESET, 0, 0));
			rootNode.AddChild(ruleSetNode);
			currentNode = ruleSetNode;
			while (tokenizer.Current.GetTokenType () == CssTokenType.IDENT 
			       || tokenizer.Current.GetTokenType () == CssTokenType.HASH
			       || tokenizer.Current.GetTokenType () == CssTokenType.CLASS)
			{
			selector ();
				if (tokenizer.Current.GetTokenType () == CssTokenType.COMMA)
					acceptElement (CssTokenType.COMMA);
			}
			
			acceptElement (CssTokenType.LEFTCURLY);
			declaration ();
			acceptElement (CssTokenType.RIGHTCURLY);
			currentNode = rootNode;
		}
예제 #4
0
		public void AddChild(CssNode t)
		{
			if (children == null)
				children = new List<CssNode> ();
			children.add(t);
		}
예제 #5
0
		public CssNode (CssToken token)
		{
			this.token = token;
			parent = null;
		}