최원준 | 1 Sep 01:38 2011
Picon

Re: [scintilla-interest] highlighting a word in coustom lexer

is this right?

stc = event.GetEventObject()
        # Last correctly styled character
        last_styled_pos = stc.GetEndStyled()
        # Get styling range for this call
        line = stc.LineFromPosition(last_styled_pos)
        start_pos = stc.PositionFromLine(line)
        end_pos = event.GetPosition()

        line_length = end_pos - start_pos
        if line_length > 0:
            stc.StartStyling(start_pos, 0x1f)
            stc.SetStyling(line_length, VowelLexer.STC_STYLE_VOWEL_DEFAULT)



2011/8/31 최원준 <wonjunchoi001 <at> gmail.com>
        while start_pos < end_pos:
            stc.StartStyling(start_pos, 0x1f)
            char = stc.GetCharAt(start_pos)
            if char in self.words:
                style = VowelLexer.STC_STYLE_VOWEL_KW
            else:
                style = VowelLexer.STC_STYLE_VOWEL_DEFAULT

from above [if char in self.words:] code checks the character.


               word
                 |
start_pos|good |end_pos

I think this will check the word.

but I have no idea how can I make it.



2011/8/31 Neil Hodgson <nyamatongwe <at> gmail.com>
Wonjun, Choi:

>> ==> how can I examing each word?

  How would you write a program that examines text input from a file
and outputs a list of words?

  Neil

--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To post to this group, send email to scintilla-interest <at> googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.



--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To post to this group, send email to scintilla-interest <at> googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.
최원준 | 1 Sep 03:04 2011
Picon

Re: [scintilla-interest] highlighting a word in coustom lexer

    def StyleText(self, event):
        """Handle the EVT_STC_STYLENEEDED event"""
        stc = event.GetEventObject()
        # Last correctly styled character
        last_styled_pos = stc.GetEndStyled()
        # Get styling range for this call
        line = stc.LineFromPosition(last_styled_pos)
        start_pos = stc.PositionFromLine(line)
        end_pos = event.GetPosition()

        while start_pos < end_pos:
            line_length = end_pos - start_pos
            word_length = start_pos + line_length
            stc.StartStyling(start_pos, 0x1f)
            for pos in range(word_length):
                if stc.GetCharAt(pos + 1) in self.words:
                    # Set Vowel Keyword style
                    style = VowelLexer.STC_STYLE_VOWEL_KW
                else:
                    # Set Default style
                    style = VowelLexer.STC_STYLE_VOWEL_DEFAULT
               
#            char = stc.GetCharAt(start_pos)
            # Set the styling byte information for 1 char from
            # current styling position (start_pos) with the
            # given style.
            stc.SetStyling(1, style)
            start_pos += 1


Is this right?
Please review this code!

2011년 9월 1일 오전 8:38, 최원준 <wonjunchoi001 <at> gmail.com>님의 말:
is this right?

stc = event.GetEventObject()
        # Last correctly styled character
        last_styled_pos = stc.GetEndStyled()
        # Get styling range for this call
        line = stc.LineFromPosition(last_styled_pos)
        start_pos = stc.PositionFromLine(line)
        end_pos = event.GetPosition()

        line_length = end_pos - start_pos
        if line_length > 0:

            stc.StartStyling(start_pos, 0x1f)
            stc.SetStyling(line_length, VowelLexer.STC_STYLE_VOWEL_DEFAULT)




2011/8/31 최원준 <wonjunchoi001 <at> gmail.com>
        while start_pos < end_pos:
            stc.StartStyling(start_pos, 0x1f)
            char = stc.GetCharAt(start_pos)
            if char in self.words:
                style = VowelLexer.STC_STYLE_VOWEL_KW
            else:
                style = VowelLexer.STC_STYLE_VOWEL_DEFAULT

from above [if char in self.words:] code checks the character.


               word
                 |
start_pos|good |end_pos

I think this will check the word.

but I have no idea how can I make it.



2011/8/31 Neil Hodgson <nyamatongwe <at> gmail.com>
Wonjun, Choi:

>> ==> how can I examing each word?

  How would you write a program that examines text input from a file
and outputs a list of words?

  Neil

--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To post to this group, send email to scintilla-interest <at> googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.




--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To post to this group, send email to scintilla-interest <at> googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.
최원준 | 1 Sep 03:21 2011
Picon

Re: [scintilla-interest] highlighting a word in coustom lexer

    def StyleText(self, event):
        """Handle the EVT_STC_STYLENEEDED event"""
        stc = event.GetEventObject()
        # Last correctly styled character
        last_styled_pos = stc.GetEndStyled()
        # Get styling range for this call
        line = stc.LineFromPosition(last_styled_pos)
        start_pos = stc.PositionFromLine(line)
        end_pos = event.GetPosition()
        words = ""
        stc.StartStyling(start_pos, 0x1f)
        while start_pos < end_pos:
            line_length = end_pos - start_pos
            word_length = start_pos + line_length
            while start_pos == word_length:
                words += stc.GetCharAt(start_pos)
                start_pos +=1
            if words in self.words:
                # Set Vowel Keyword style
                style = VowelLexer.STC_STYLE_VOWEL_KW
            else:
                # Set Default style
                style = VowelLexer.STC_STYLE_VOWEL_DEFAULT

            stc.SetStyling(1, style)
            start_pos += 1



am I right? or how to fix this code?


2011년 9월 1일 오전 10:04, 최원준 <wonjunchoi001 <at> gmail.com>님의 말:
    def StyleText(self, event):
        """Handle the EVT_STC_STYLENEEDED event"""

        stc = event.GetEventObject()
        # Last correctly styled character
        last_styled_pos = stc.GetEndStyled()
        # Get styling range for this call
        line = stc.LineFromPosition(last_styled_pos)
        start_pos = stc.PositionFromLine(line)
        end_pos = event.GetPosition()

        while start_pos < end_pos:
            line_length = end_pos - start_pos
            word_length = start_pos + line_length

            stc.StartStyling(start_pos, 0x1f)
            for pos in range(word_length):
                if stc.GetCharAt(pos + 1) in self.words:
                    # Set Vowel Keyword style

                    style = VowelLexer.STC_STYLE_VOWEL_KW
                else:
                    # Set Default style

                    style = VowelLexer.STC_STYLE_VOWEL_DEFAULT
               
#            char = stc.GetCharAt(start_pos)
            # Set the styling byte information for 1 char from
            # current styling position (start_pos) with the
            # given style.
            stc.SetStyling(1, style)
            start_pos += 1


Is this right?
Please review this code!

2011년 9월 1일 오전 8:38, 최원준 <wonjunchoi001 <at> gmail.com>님의 말:

is this right?

stc = event.GetEventObject()
        # Last correctly styled character
        last_styled_pos = stc.GetEndStyled()
        # Get styling range for this call
        line = stc.LineFromPosition(last_styled_pos)
        start_pos = stc.PositionFromLine(line)
        end_pos = event.GetPosition()

        line_length = end_pos - start_pos
        if line_length > 0:

            stc.StartStyling(start_pos, 0x1f)
            stc.SetStyling(line_length, VowelLexer.STC_STYLE_VOWEL_DEFAULT)




2011/8/31 최원준 <wonjunchoi001 <at> gmail.com>
        while start_pos < end_pos:
            stc.StartStyling(start_pos, 0x1f)
            char = stc.GetCharAt(start_pos)
            if char in self.words:
                style = VowelLexer.STC_STYLE_VOWEL_KW
            else:
                style = VowelLexer.STC_STYLE_VOWEL_DEFAULT

from above [if char in self.words:] code checks the character.


               word
                 |
start_pos|good |end_pos

I think this will check the word.

but I have no idea how can I make it.



2011/8/31 Neil Hodgson <nyamatongwe <at> gmail.com>
Wonjun, Choi:

>> ==> how can I examing each word?

  How would you write a program that examines text input from a file
and outputs a list of words?

  Neil

--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To post to this group, send email to scintilla-interest <at> googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.





--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To post to this group, send email to scintilla-interest <at> googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.
최원준 | 1 Sep 04:32 2011
Picon

Re: [scintilla-interest] highlighting a word in coustom lexer

I have found some document but I don't know how to do that

-----------------------------------------------------------------------------------------
The lexer code

The task of a lexer can be summarized briefly: for each range r of
characters that are to be colored the same, the lexer should call

    styler.ColourTo(i, state)
       
where i is the position of the last character of the range r.  The lexer
should set the state variable to the coloring state of the character at
position i and continue until the entire text has been colored.

Note 1:  the styler (Accessor) object remembers the i parameter in the
previous calls to styler.ColourTo, so the single i parameter suffices to
indicate a range of characters.

Note 2: As a side effect of calling styler.ColourTo(i,state), the
coloring states of all characters in the range are remembered so that
Scintilla may set the initStyle parameter correctly on future calls to
the
lexer.


Lexer organization

There are at least two ways to organize the code of each lexer.  Present
lexers use what might be called a "character-based" approach: the outer
loop iterates over characters, like this:

  lengthDoc = startPos + length ;
  for (unsigned int i = startPos; i < lengthDoc; i++) {
    chNext = styler.SafeGetCharAt(i + 1);
    << handle special cases >>
    switch(state) {
      // Handlers examine only ch and chNext.
      // Handlers call styler.ColorTo(i,state) if the state changes.
      case state_1: << handle ch in state 1 >>
      case state_2: << handle ch in state 2 >>
      ...
      case state_n: << handle ch in state n >>
    }
    chPrev = ch;
  }
  styler.ColourTo(lengthDoc - 1, state);


An alternative would be to use a "state-based" approach.  The outer loop
would iterate over states, like this:

  lengthDoc = startPos+lenth ;
  for ( unsigned int i = startPos ;; ) {
    char ch = styler.SafeGetCharAt(i);
    int new_state = 0 ;
    switch ( state ) {
      // scanners set new_state if they set the next state.
      case state_1: << scan to the end of state 1 >> break ;
      case state_2: << scan to the end of state 2 >> break ;
      case default_state:
        << scan to the next non-default state and set new_state >>
    }
    styler.ColourTo(i, state);
    if ( i >= lengthDoc ) break ;
    if ( ! new_state ) {
      ch = styler.SafeGetCharAt(i);
      << set state based on ch in the default state >>
    }
  }
  styler.ColourTo(lengthDoc - 1, state);

This approach might seem to be more natural.  State scanners are simpler
than character scanners because less needs to be done.  For example,
there is no need to test for the start of a C string inside the scanner
for a C comment.  Also this way makes it natural to define routines that
could be used by more than one scanner; for example, a scanToEndOfLine
routine.
-----------------------------------------------------------------------------------------

2011년 9월 1일 오전 10:21, 최원준 <wonjunchoi001 <at> gmail.com>님의 말:
    def StyleText(self, event):
        """Handle the EVT_STC_STYLENEEDED event"""
        stc = event.GetEventObject()
        # Last correctly styled character
        last_styled_pos = stc.GetEndStyled()
        # Get styling range for this call
        line = stc.LineFromPosition(last_styled_pos)
        start_pos = stc.PositionFromLine(line)
        end_pos = event.GetPosition()
        words = ""

        stc.StartStyling(start_pos, 0x1f)
        while start_pos < end_pos:
            line_length = end_pos - start_pos
            word_length = start_pos + line_length
            while start_pos == word_length:
                words += stc.GetCharAt(start_pos)
                start_pos +=1
            if words in self.words:

                # Set Vowel Keyword style
                style = VowelLexer.STC_STYLE_VOWEL_KW
            else:
                # Set Default style
                style = VowelLexer.STC_STYLE_VOWEL_DEFAULT

            stc.SetStyling(1, style)
            start_pos += 1



am I right? or how to fix this code?


2011년 9월 1일 오전 10:04, 최원준 <wonjunchoi001 <at> gmail.com>님의 말:

    def StyleText(self, event):
        """Handle the EVT_STC_STYLENEEDED event"""

        stc = event.GetEventObject()
        # Last correctly styled character
        last_styled_pos = stc.GetEndStyled()
        # Get styling range for this call
        line = stc.LineFromPosition(last_styled_pos)
        start_pos = stc.PositionFromLine(line)
        end_pos = event.GetPosition()

        while start_pos < end_pos:
            line_length = end_pos - start_pos
            word_length = start_pos + line_length

            stc.StartStyling(start_pos, 0x1f)
            for pos in range(word_length):
                if stc.GetCharAt(pos + 1) in self.words:
                    # Set Vowel Keyword style

                    style = VowelLexer.STC_STYLE_VOWEL_KW
                else:
                    # Set Default style

                    style = VowelLexer.STC_STYLE_VOWEL_DEFAULT
               
#            char = stc.GetCharAt(start_pos)
            # Set the styling byte information for 1 char from
            # current styling position (start_pos) with the
            # given style.
            stc.SetStyling(1, style)
            start_pos += 1


Is this right?
Please review this code!

2011년 9월 1일 오전 8:38, 최원준 <wonjunchoi001 <at> gmail.com>님의 말:

is this right?

stc = event.GetEventObject()
        # Last correctly styled character
        last_styled_pos = stc.GetEndStyled()
        # Get styling range for this call
        line = stc.LineFromPosition(last_styled_pos)
        start_pos = stc.PositionFromLine(line)
        end_pos = event.GetPosition()

        line_length = end_pos - start_pos
        if line_length > 0:

            stc.StartStyling(start_pos, 0x1f)
            stc.SetStyling(line_length, VowelLexer.STC_STYLE_VOWEL_DEFAULT)




2011/8/31 최원준 <wonjunchoi001 <at> gmail.com>
        while start_pos < end_pos:
            stc.StartStyling(start_pos, 0x1f)
            char = stc.GetCharAt(start_pos)
            if char in self.words:
                style = VowelLexer.STC_STYLE_VOWEL_KW
            else:
                style = VowelLexer.STC_STYLE_VOWEL_DEFAULT

from above [if char in self.words:] code checks the character.


               word
                 |
start_pos|good |end_pos

I think this will check the word.

but I have no idea how can I make it.



2011/8/31 Neil Hodgson <nyamatongwe <at> gmail.com>
Wonjun, Choi:

>> ==> how can I examing each word?

  How would you write a program that examines text input from a file
and outputs a list of words?

  Neil

--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To post to this group, send email to scintilla-interest <at> googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.






--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To post to this group, send email to scintilla-interest <at> googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.
Gus | 1 Sep 06:33 2011
Picon

Re: Annotations not displayed in Windows 7

Hello Neil:

I'm using WinDev (similar to Visual Basic).. Anyway it's working
now.... I had to use the latest SciLexer.dll so it seems the older one
had some problem...

I guess I will need to build my own lexer... What compiler do you
recommend for Windows 7? May I use Visual Studio 2008 C/C++ ?

Thanks for your support!
Gus

On Aug 30, 4:39 pm, Neil Hodgson <nyamaton... <at> gmail.com> wrote:
> Gus:
>
> > Any other idea what could be wrong?
> > sText is string = "Hello World!\nSecondLine\n"
> > SendMessage(gnHwndScintilla,SCI_ANNOTATIONSETTEXT, 10, &sText)
>
>    C++ doesn't have an 'is' keyword so doesn't appear to be C/C++. If
> sText is a std::string then you shouldn't be taking its address as an
> argument.
>
>    Neil

--

-- 
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To post to this group, send email to scintilla-interest <at> googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.

Gus | 1 Sep 06:49 2011
Picon

Re: Annotations not displayed in Windows 7

I just read the README file and it's explained there!

I'm sorry for asking without reading first...

Regards;
Gus

On Aug 31, 9:33 pm, Gus <gussab... <at> yahoo.com> wrote:
> Hello Neil:
>
> I'm using WinDev (similar to Visual Basic).. Anyway it's working
> now.... I had to use the latest SciLexer.dll so it seems the older one
> had some problem...
>
> I guess I will need to build my own lexer... What compiler do you
> recommend for Windows 7? May I use Visual Studio 2008 C/C++ ?
>
> Thanks for your support!
> Gus
>
> On Aug 30, 4:39 pm, Neil Hodgson <nyamaton... <at> gmail.com> wrote:
>
>
>
> > Gus:
>
> > > Any other idea what could be wrong?
> > > sText is string = "Hello World!\nSecondLine\n"
> > > SendMessage(gnHwndScintilla,SCI_ANNOTATIONSETTEXT, 10, &sText)
>
> >    C++ doesn't have an 'is' keyword so doesn't appear to be C/C++. If
> > sText is a std::string then you shouldn't be taking its address as an
> > argument.
>
> >    Neil- Hide quoted text -
>
> - Show quoted text -

--

-- 
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To post to this group, send email to scintilla-interest <at> googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.

최원준 | 1 Sep 08:54 2011
Picon

Re: [scintilla-interest] highlighting a word in coustom lexer

    def StyleText(self, event):
        stc = event.GetEventObject()
        # Last correctly styled character
        last_styled_pos = stc.GetEndStyled()
        # Get styling range for this call
        line = stc.LineFromPosition(last_styled_pos)
        start = stc.PositionFromLine(line)
        end = event.GetPosition()
        # First, figure out the line based on the position.
        line = stc.LineFromPosition(start)
   
        # Find the start of the line that's been styled before this one.
        while line > 0 and stc.GetLineState(line) == 0:
            line -= 1
   
        eline = stc.LineFromPosition(end)
   
        state = stc.GetLineState(line) - 1
        if state < 0:
            state = 0
   
        for ln in range(line, eline + 1):
            text = stc.GetLine(ln).encode('utf-8')
            len_text = len(text)
            text = text.strip()
   
            if len(text) == 0:
                state = 0
            else:
                if len(text) > 0:
                    ch = text[0]
                    ix = issl_table.find(ch)
                    if ix >= 0:
                        state = ix + 1
   
            stc.StartStyling(stc.PositionFromLine(ln), 0xFF)
            stc.SetStyling(len_text, state)
   
            stc.SetLineState(ln, state + 1)


I have found this and modified. could you review this?

2011년 9월 1일 오전 11:32, 최원준 <wonjunchoi001 <at> gmail.com>님의 말:
I have found some document but I don't know how to do that

-----------------------------------------------------------------------------------------
The lexer code

The task of a lexer can be summarized briefly: for each range r of
characters that are to be colored the same, the lexer should call

    styler.ColourTo(i, state)
       
where i is the position of the last character of the range r.  The lexer
should set the state variable to the coloring state of the character at
position i and continue until the entire text has been colored.

Note 1:  the styler (Accessor) object remembers the i parameter in the
previous calls to styler.ColourTo, so the single i parameter suffices to
indicate a range of characters.

Note 2: As a side effect of calling styler.ColourTo(i,state), the
coloring states of all characters in the range are remembered so that
Scintilla may set the initStyle parameter correctly on future calls to
the
lexer.


Lexer organization

There are at least two ways to organize the code of each lexer.  Present
lexers use what might be called a "character-based" approach: the outer
loop iterates over characters, like this:

  lengthDoc = startPos + length ;
  for (unsigned int i = startPos; i < lengthDoc; i++) {
    chNext = styler.SafeGetCharAt(i + 1);
    << handle special cases >>
    switch(state) {
      // Handlers examine only ch and chNext.
      // Handlers call styler.ColorTo(i,state) if the state changes.
      case state_1: << handle ch in state 1 >>
      case state_2: << handle ch in state 2 >>
      ...
      case state_n: << handle ch in state n >>
    }
    chPrev = ch;
  }
  styler.ColourTo(lengthDoc - 1, state);


An alternative would be to use a "state-based" approach.  The outer loop
would iterate over states, like this:

  lengthDoc = startPos+lenth ;
  for ( unsigned int i = startPos ;; ) {
    char ch = styler.SafeGetCharAt(i);
    int new_state = 0 ;
    switch ( state ) {
      // scanners set new_state if they set the next state.
      case state_1: << scan to the end of state 1 >> break ;
      case state_2: << scan to the end of state 2 >> break ;
      case default_state:
        << scan to the next non-default state and set new_state >>
    }
    styler.ColourTo(i, state);
    if ( i >= lengthDoc ) break ;
    if ( ! new_state ) {
      ch = styler.SafeGetCharAt(i);
      << set state based on ch in the default state >>
    }
  }
  styler.ColourTo(lengthDoc - 1, state);

This approach might seem to be more natural.  State scanners are simpler
than character scanners because less needs to be done.  For example,
there is no need to test for the start of a C string inside the scanner
for a C comment.  Also this way makes it natural to define routines that
could be used by more than one scanner; for example, a scanToEndOfLine
routine.
-----------------------------------------------------------------------------------------

2011년 9월 1일 오전 10:21, 최원준 <wonjunchoi001 <at> gmail.com>님의 말:

    def StyleText(self, event):
        """Handle the EVT_STC_STYLENEEDED event"""
        stc = event.GetEventObject()
        # Last correctly styled character
        last_styled_pos = stc.GetEndStyled()
        # Get styling range for this call
        line = stc.LineFromPosition(last_styled_pos)
        start_pos = stc.PositionFromLine(line)
        end_pos = event.GetPosition()
        words = ""

        stc.StartStyling(start_pos, 0x1f)
        while start_pos < end_pos:
            line_length = end_pos - start_pos
            word_length = start_pos + line_length
            while start_pos == word_length:
                words += stc.GetCharAt(start_pos)
                start_pos +=1
            if words in self.words:

                # Set Vowel Keyword style
                style = VowelLexer.STC_STYLE_VOWEL_KW
            else:
                # Set Default style
                style = VowelLexer.STC_STYLE_VOWEL_DEFAULT

            stc.SetStyling(1, style)
            start_pos += 1



am I right? or how to fix this code?


2011년 9월 1일 오전 10:04, 최원준 <wonjunchoi001 <at> gmail.com>님의 말:

    def StyleText(self, event):
        """Handle the EVT_STC_STYLENEEDED event"""

        stc = event.GetEventObject()
        # Last correctly styled character
        last_styled_pos = stc.GetEndStyled()
        # Get styling range for this call
        line = stc.LineFromPosition(last_styled_pos)
        start_pos = stc.PositionFromLine(line)
        end_pos = event.GetPosition()

        while start_pos < end_pos:
            line_length = end_pos - start_pos
            word_length = start_pos + line_length

            stc.StartStyling(start_pos, 0x1f)
            for pos in range(word_length):
                if stc.GetCharAt(pos + 1) in self.words:
                    # Set Vowel Keyword style

                    style = VowelLexer.STC_STYLE_VOWEL_KW
                else:
                    # Set Default style

                    style = VowelLexer.STC_STYLE_VOWEL_DEFAULT
               
#            char = stc.GetCharAt(start_pos)
            # Set the styling byte information for 1 char from
            # current styling position (start_pos) with the
            # given style.
            stc.SetStyling(1, style)
            start_pos += 1


Is this right?
Please review this code!

2011년 9월 1일 오전 8:38, 최원준 <wonjunchoi001 <at> gmail.com>님의 말:

is this right?

stc = event.GetEventObject()
        # Last correctly styled character
        last_styled_pos = stc.GetEndStyled()
        # Get styling range for this call
        line = stc.LineFromPosition(last_styled_pos)
        start_pos = stc.PositionFromLine(line)
        end_pos = event.GetPosition()

        line_length = end_pos - start_pos
        if line_length > 0:

            stc.StartStyling(start_pos, 0x1f)
            stc.SetStyling(line_length, VowelLexer.STC_STYLE_VOWEL_DEFAULT)




2011/8/31 최원준 <wonjunchoi001 <at> gmail.com>
        while start_pos < end_pos:
            stc.StartStyling(start_pos, 0x1f)
            char = stc.GetCharAt(start_pos)
            if char in self.words:
                style = VowelLexer.STC_STYLE_VOWEL_KW
            else:
                style = VowelLexer.STC_STYLE_VOWEL_DEFAULT

from above [if char in self.words:] code checks the character.


               word
                 |
start_pos|good |end_pos

I think this will check the word.

but I have no idea how can I make it.



2011/8/31 Neil Hodgson <nyamatongwe <at> gmail.com>
Wonjun, Choi:

>> ==> how can I examing each word?

  How would you write a program that examines text input from a file
and outputs a list of words?

  Neil

--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To post to this group, send email to scintilla-interest <at> googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.







--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To post to this group, send email to scintilla-interest <at> googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.
Neil Hodgson | 1 Sep 10:19 2011
Picon

Re: [scintilla-interest] highlighting a word in coustom lexer

wonjunchoi001:

>     def StyleText(self, event):
>         stc = event.GetEventObject()
>         # Last correctly styled character
>         last_styled_pos = stc.GetEndStyled()
>         # Get styling range for this call
>         line = stc.LineFromPosition(last_styled_pos)
>         start = stc.PositionFromLine(line)
>         end = event.GetPosition()
>         # First, figure out the line based on the position.
>         line = stc.LineFromPosition(start)

   You already have 'line' at this point.

>         # Find the start of the line that's been styled before this one.
>         while line > 0 and stc.GetLineState(line) == 0:
>             line -= 1

   You are examining lines that have already been styled.

>         eline = stc.LineFromPosition(end)
>
>         state = stc.GetLineState(line) - 1

   I don't understand why you are using line state.

>         if state < 0:
>             state = 0
>
>         for ln in range(line, eline + 1):
>             text = stc.GetLine(ln).encode('utf-8')
>             len_text = len(text)
>             text = text.strip()
>
>             if len(text) == 0:
>                 state = 0
>             else:
>                 if len(text) > 0:
>                     ch = text[0]
>                     ix = issl_table.find(ch)
>                     if ix >= 0:
>                         state = ix + 1
>
>             stc.StartStyling(stc.PositionFromLine(ln), 0xFF)
>             stc.SetStyling(len_text, state)

   This code appears to be styling whole lines. I thought the
intention was to style words.

   Neil

--

-- 
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To post to this group, send email to scintilla-interest <at> googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.

Gus | 1 Sep 18:06 2011
Picon

Error building scintilla in Windows 7 64-bit and Visual Studio 2008 SP1

Hi All:

I want to build scintilla in Windows 7 64-bit with Visual Studio 2008
SP1, and when I try to run :
nmake -f scintilla.mak
I get following errors:

Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.

        rc -fo.\ScintRes.res ScintRes.rc
'rc' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: 'rc' : return code '0x1'
Stop.

I installed SDK for Windows 7, but I still getting this error...

I would appreciatte any help since I'm not experienced with this
environment (I use scintilla from a Visual Languaje).

Thanks;
Gus

--

-- 
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To post to this group, send email to scintilla-interest <at> googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.

최원준 | 1 Sep 21:48 2011
Picon

Re: [scintilla-interest] highlighting a word in coustom lexer

char = stc.GetCharAt(start_pos)
            if char in self.vowels:

Should I use other method instead of GetCharAt method?
and then check the word?

or

start_pos = stc.PositionFromLine(line)
end_pos = event.GetPosition()

length = end_pos - start_pos

word = ""

while start_pos < end_pos:
   if length > 0:
      for n in range(length):
          word += stc.GetCharAt(n)
      if word in self.vowels:
         style = VowelLexer.STC_STYLE_VOWEL_KW
      else:
         style = VowelLexer.STC_STYLE_VOWEL_DEFAULT

   stc.SetStyling(1, style)
   start_pos += 1

I am not sure this code is right but I got an error at this point ( word += stc.GetCharAt(n) )
word variable is string and stc.GetCharAt() method returns integer type.

and please recommend your opinion!



2011/9/1 Neil Hodgson <nyamatongwe <at> gmail.com>
wonjunchoi001:

>     def StyleText(self, event):
>         stc = event.GetEventObject()
>         # Last correctly styled character
>         last_styled_pos = stc.GetEndStyled()
>         # Get styling range for this call
>         line = stc.LineFromPosition(last_styled_pos)
>         start = stc.PositionFromLine(line)
>         end = event.GetPosition()
>         # First, figure out the line based on the position.
>         line = stc.LineFromPosition(start)

  You already have 'line' at this point.

>         # Find the start of the line that's been styled before this one.
>         while line > 0 and stc.GetLineState(line) == 0:
>             line -= 1

  You are examining lines that have already been styled.

>         eline = stc.LineFromPosition(end)
>
>         state = stc.GetLineState(line) - 1

  I don't understand why you are using line state.

>         if state < 0:
>             state = 0
>
>         for ln in range(line, eline + 1):
>             text = stc.GetLine(ln).encode('utf-8')
>             len_text = len(text)
>             text = text.strip()
>
>             if len(text) == 0:
>                 state = 0
>             else:
>                 if len(text) > 0:
>                     ch = text[0]
>                     ix = issl_table.find(ch)
>                     if ix >= 0:
>                         state = ix + 1
>
>             stc.StartStyling(stc.PositionFromLine(ln), 0xFF)
>             stc.SetStyling(len_text, state)

  This code appears to be styling whole lines. I thought the
intention was to style words.

  Neil

--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To post to this group, send email to scintilla-interest <at> googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.


--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To post to this group, send email to scintilla-interest <at> googlegroups.com.
To unsubscribe from this group, send email to scintilla-interest+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.

Gmane