io.sarl.lang.pythongenerator.generator
Class PyExpressionGenerator
All Superinterfaces:
IExpressionGenerator
class PyExpressionGenerator
extends AbstractExpressionGenerator
Generator of XExpression for Python 3.
Maven Group Identifier:
io.sarl.lang
Maven Artifact Identifier:
pythongenerator
Since:
0.6
Property Summary
Nested Type Summary
Modifier and type Type and description
class PyExpressionGenerator.PyFeatureCallGenerator
Feature call generator for Python.
Constructor Summary
Constructor and description
new(PyKeywordProvider)
Constructor.
Action Summary
Modifier and type Action and description
protected org.eclipse.xtext.xbase.XExpression _generate(SarlAssertExpression,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(SarlBreakExpression,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(SarlContinueExpression,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(AnonymousClass,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XAssignment,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XBasicForLoopExpression,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XBinaryOperation,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XBlockExpression,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XBooleanLiteral,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XCastedExpression,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XClosure,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XConstructorCall,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XDoWhileExpression,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XFeatureCall,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XForLoopExpression,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XIfExpression,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XInstanceOfExpression,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XListLiteral,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XMemberFeatureCall,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XNullLiteral,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XNumberLiteral,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XPostfixOperation,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XReturnExpression,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XSetLiteral,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XStringLiteral,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XSwitchExpression,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XSynchronizedExpression,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XThrowExpression,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XTryCatchFinallyExpression,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XTypeLiteral,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XUnaryOperation,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XVariableDeclaration,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected org.eclipse.xtext.xbase.XExpression _generate(XWhileExpression,IAppendable,IExtraLanguageGeneratorContext)
Generate the given object.
protected void before(XExpression,IAppendable,IExtraLanguageGeneratorContext)
protected void generateAnonymousClassDefinition(AnonymousClass,IAppendable,IExtraLanguageGeneratorContext)
Generate the anonymous class definition.
protected void generateClosureDefinition(XClosure,IAppendable,IExtraLanguageGeneratorContext)
Generate the closure definition.
protected IExtraLanguageConversionInitializer getFeatureNameConverterInitializer
protected IExtraLanguageConversionInitializer getTypeConverterInitializer
protected PyFeatureCallGenerator newFeatureCallGenerator(IExtraLanguageGeneratorContext,IAppendable)
Generate a feature call.
static java.lang.String toDefaultValue(JvmTypeReference)
Replies the Python default value for the given type.
Property Details
featureNameConverterInitializer
protected val featureNameConverterInitializer : IExtraLanguageConversionInitializer

This property is an alias for the action: getFeatureNameConverterInitializer

typeConverterInitializer
protected val typeConverterInitializer : IExtraLanguageConversionInitializer

This property is an alias for the action: getTypeConverterInitializer

Constructor Details
new(PyKeywordProvider)
new(PyKeywordProvider)
Constructor.
Parameters:
keywordProvider - the provider of Python keywords.
Action Details
_generate(SarlAssertExpression,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(SarlAssertExpression,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
assertStatement - the assert statement.
it - the target for the generated content.
context - the context.
Returns:
the statement.
_generate(SarlBreakExpression,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(SarlBreakExpression,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
breakStatement - the break statement.
it - the target for the generated content.
context - the context.
Returns:
the statement.
_generate(SarlContinueExpression,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(SarlContinueExpression,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
continueStatement - the continue statement.
it - the target for the generated content.
context - the context.
Returns:
the statement.
_generate(AnonymousClass,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(AnonymousClass,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
anonClass - the anonymous class.
it - the target for the generated content.
context - the context.
Returns:
the class definition.
_generate(XAssignment,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XAssignment,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
assignment - the assignment operator.
it - the target for the generated content.
context - the context.
Returns:
the assignment.
_generate(XBasicForLoopExpression,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XBasicForLoopExpression,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
forLoop - the for-loop.
it - the target for the generated content.
context - the context.
Returns:
the last statement in the loop or null .
_generate(XBinaryOperation,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XBinaryOperation,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
operation - the binary operation.
it - the target for the generated content.
context - the context.
Returns:
the operation.
_generate(XBlockExpression,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XBlockExpression,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
block - the block expression.
it - the target for the generated content.
context - the context.
Returns:
the last expression in the block or null .
_generate(XBooleanLiteral,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XBooleanLiteral,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
literal - the boolean literal.
it - the target for the generated content.
context - the context.
Returns:
the literal.
_generate(XCastedExpression,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XCastedExpression,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
castOperator - the cast operator.
it - the target for the generated content.
context - the context.
Returns:
the expression.
_generate(XClosure,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XClosure,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
closure - the closure.
it - the target for the generated content.
context - the context.
Returns:
the closure.
_generate(XConstructorCall,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XConstructorCall,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
call - the constructor call.
it - the target for the generated content.
context - the context.
Returns:
the constructor call.
_generate(XDoWhileExpression,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XDoWhileExpression,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
whileLoop - the while-loop.
it - the target for the generated content.
context - the context.
Returns:
the last statement in the loop or null .
_generate(XFeatureCall,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XFeatureCall,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
call - the feature call.
it - the target for the generated content.
context - the context.
Returns:
the feature call.
_generate(XForLoopExpression,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XForLoopExpression,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
forLoop - the for-loop.
it - the target for the generated content.
context - the context.
Returns:
the statement.
_generate(XIfExpression,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XIfExpression,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
ifStatement - the if-then-else statement.
it - the target for the generated content.
context - the context.
Returns:
the statement.
_generate(XInstanceOfExpression,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XInstanceOfExpression,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
operator - the instance-of operator.
it - the target for the generated content.
context - the context.
Returns:
the expression.
_generate(XListLiteral,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XListLiteral,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
literal - the list literal.
it - the target for the generated content.
context - the context.
Returns:
the literal.
_generate(XMemberFeatureCall,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XMemberFeatureCall,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
call - the member feature call.
it - the target for the generated content.
context - the context.
Returns:
the feature call.
_generate(XNullLiteral,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XNullLiteral,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
literal - the null literal.
it - the target for the generated content.
context - the context.
Returns:
the literal.
_generate(XNumberLiteral,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XNumberLiteral,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
literal - the literal.
it - the target for the generated content.
context - the context.
Returns:
the literal.
_generate(XPostfixOperation,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XPostfixOperation,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
operation - the postfix operator.
it - the target for the generated content.
context - the context.
Returns:
the operation.
_generate(XReturnExpression,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XReturnExpression,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
returnStatement - the return statement.
it - the target for the generated content.
context - the context.
Returns:
the statement.
_generate(XSetLiteral,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XSetLiteral,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
literal - the set literal.
it - the target for the generated content.
context - the context.
Returns:
the literal.
_generate(XStringLiteral,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XStringLiteral,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
literal - the literal.
it - the target for the generated content.
context - the context.
Returns:
the literal.
_generate(XSwitchExpression,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XSwitchExpression,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
switchStatement - the switch statement.
it - the target for the generated content.
context - the context.
Returns:
the statement.
_generate(XSynchronizedExpression,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XSynchronizedExpression,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
synchronizedStatement - the synchronized statement.
it - the target for the generated content.
context - the context.
Returns:
the statement.
_generate(XThrowExpression,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XThrowExpression,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
throwStatement - the throw statement.
it - the target for the generated content.
context - the context.
Returns:
the statement.
_generate(XTryCatchFinallyExpression,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XTryCatchFinallyExpression,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
tryStatement - the try-catch-finally statement.
it - the target for the generated content.
context - the context.
Returns:
the statement.
_generate(XTypeLiteral,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XTypeLiteral,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
literal - the type literal.
it - the target for the generated content.
context - the context.
Returns:
the literal.
_generate(XUnaryOperation,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XUnaryOperation,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
operation - the unary operation.
it - the target for the generated content.
context - the context.
Returns:
the operation.
_generate(XVariableDeclaration,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XVariableDeclaration,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
varDeclaration - the variable declaration.
it - the target for the generated content.
context - the context.
Returns:
the statement.
_generate(XWhileExpression,IAppendable,IExtraLanguageGeneratorContext)
protected def _generate(XWhileExpression,IAppendable,IExtraLanguageGeneratorContext) : org.eclipse.xtext.xbase.XExpression
Generate the given object.
Parameters:
whileLoop - the while-loop.
it - the target for the generated content.
context - the context.
Returns:
the last statement in the loop or null .
before(XExpression,IAppendable,IExtraLanguageGeneratorContext)
protected def before(XExpression,IAppendable,IExtraLanguageGeneratorContext)
generateAnonymousClassDefinition(AnonymousClass,IAppendable,IExtraLanguageGeneratorContext)
protected def generateAnonymousClassDefinition(AnonymousClass,IAppendable,IExtraLanguageGeneratorContext)
Generate the anonymous class definition.
Parameters:
anonClass - the anonymous class.
it - the target for the generated content.
context - the context.
generateClosureDefinition(XClosure,IAppendable,IExtraLanguageGeneratorContext)
protected def generateClosureDefinition(XClosure,IAppendable,IExtraLanguageGeneratorContext)
Generate the closure definition.
Parameters:
closure - the closure.
it - the target for the generated content.
context - the context.
getFeatureNameConverterInitializer
protected def getFeatureNameConverterInitializer : IExtraLanguageConversionInitializer
getTypeConverterInitializer
protected def getTypeConverterInitializer : IExtraLanguageConversionInitializer
newFeatureCallGenerator(IExtraLanguageGeneratorContext,IAppendable)
protected def newFeatureCallGenerator(IExtraLanguageGeneratorContext,IAppendable) : PyFeatureCallGenerator
Generate a feature call.
Parameters:
context - the generation context.
it - the code receiver.
Returns:
the generator
toDefaultValue(JvmTypeReference)
def toDefaultValue(JvmTypeReference) : java.lang.String
Replies the Python default value for the given type.
Parameters:
type - the type.
Returns:
the default value.