We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Issue with writing a Custom language specification for Python

Thread ID:

Created:

Updated:

Platform:

Replies:

149332 Nov 22,2019 12:35 AM UTC Sep 29,2020 07:08 AM UTC WinForms 7
loading
Tags: EditControl
gavin
Asked On November 22, 2019 12:35 AM UTC

Hi

I'm trying to write a custom language specification for Python for the editControl.  I can do everything that I want to do, except one item.  The issue is the indentation for python as it doesn't happen between pairs of brackets.  A typical indentation in python looks like this:


def test():
     for i in range(10):
          print(i)
          print(i+1)

The code I'm using my config.xml file is shown below.  The issue is what do I put as the EndBlock as python doesn't have an endblock character?

 <lexem BeginBlock=":" EndBlock="????" Type="KeyWord" IsComplex="true" IsCollapsable="true" Indent="true" DropContextPrompt="true" 
        CollapseName=":...">
        <SubLexems>
          <lexem BeginBlock="\\n" IsBeginRegex="true" />
        </SubLexems>
      </lexem>

Thanks for your help.  


Kanniyappan Panneer Selvam [Syncfusion]
Replied On November 23, 2019 06:23 AM UTC

Hi Gavin, 
 
Thanks for contacting Syncfusion support. 
 
The issue is the indentation for python as it doesn't happen between pairs of brackets 
 
The issue is what do I put as the EndBlock as python doesn't have an endblock character? 
We are currently checking on your queries at our end and updating the further details in two business days.  
 
If possible, can you please provide clear information about your requirement with an image illustration, it would help us to provide you with the solution as soon as possible. 
 
 
Regards, 
Kanniyappan P 


gavin
Replied On November 23, 2019 03:37 PM UTC

I hope this explanation explains what I am trying to do.

I'm trying to find a way to perform auto indentation. The issue is described below:

"Most of the programming languages like C, C++, Java use braces { } to define a block of code. Python uses indentation.
A code block (body of a functionloop etc.) starts (in python) with indentation and ends with the first unindented line. The amount of indentation is up to you, but it must be consistent throughout that block."

I can start the block fine.  All blocks start with a ":" eg:

def test():   
     print("hello world")  

The problem is how do I indicate an end of block, so that the auto indentation stops, as the end of block is signalled by an unindented line rather than a symbol such as '}'

Thanks



Kanniyappan Panneer Selvam [Syncfusion]
Replied On November 25, 2019 07:32 AM UTC

Hi Gavin, 
 
Thanks for your update. 
 
Currently EditControl does not have support to achieve your requirement “Define dynamic BeginBlock and EndBlock based on python language”. So, we will consider to provide built-in support Python language in future and logged a feature request for “Provide built-In support for python language in EditControl” and it can be tracked through our feedback portal below. We will implement this feature in any of our upcoming release.  
 
 
Please cast your vote to make it count. We will prioritize the features every release based on the demands.  
 
If you have any more specification/suggestions to the feature request you can add it as a comment in the portal.  
 
Regards, 
Kanniyappan P 
 


surbhi nahta
Replied On May 4, 2020 10:42 AM UTC

Hi,


I was having the same issue for Python and couldn't find the solution till yet. but now i think this will work.


Niranjan Kumar Gopalan [Syncfusion]
Replied On May 4, 2020 11:48 AM UTC

Hi Surbhi, 

Thanks for your update. 

We will wait to hear from you.  

Regards, 
Niranjan Kumar Gopalan 
 


Florene J Anderson
Replied On September 24, 2020 11:14 AM UTC

Thank you for such a valuable information. I was looking for a long time detailed explanation. Really appreciate your reply!

Niranjan Kumar Gopalan [Syncfusion]
Replied On September 25, 2020 04:55 AM UTC

Hi Florene, 

We are glad to be of assistance. 

Regards, 
Niranjan Kumar Gopalan 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon