/*
 * generated by Xtext 2.14.0
 */
package com.minres.rdl.formatting2

import com.minres.rdl.rdl.PropertyDefinition
import com.minres.rdl.rdl.Root
import org.eclipse.xtext.formatting2.AbstractFormatter2
import org.eclipse.xtext.formatting2.IFormattableDocument

class RDLFormatter extends AbstractFormatter2 {
	
	//@Inject extension RDLGrammarAccess

	def dispatch void format(Root root, extension IFormattableDocument document) {
		// TODO: format HiddenRegions around keywords, attributes, cross references, etc. 
		for (include : root.includes) {
			include.format
		}
		for (componentDefinition : root.componentDefinitions) {
			componentDefinition.format
		}
		for (enumDefinition : root.enumDefinitions) {
			enumDefinition.format
		}
		for (instantiation : root.instantiations) {
			instantiation.format
		}
		for (propertyAssignment : root.propertyAssignments) {
			propertyAssignment.format
		}
		for (propertyDefinition : root.propertyDefinitions) {
			propertyDefinition.format
		}
	}

	def dispatch void format(PropertyDefinition propertyDefinition, extension IFormattableDocument document) {
		// TODO: format HiddenRegions around keywords, attributes, cross references, etc. 
		propertyDefinition.usage.format
		propertyDefinition.^default.format
	}
	
	// TODO: implement for ComponentDefinition, Instantiation, ComponentInstance, ExplicitPropertyAssignment, PostPropertyAssignment, InstancePropertyRef, InstanceRef, PropertyAssignmentRhs, Concat, ConcatElem, EnumDefinition, EnumBody, EnumEntry
}
