Skip to content

Commit

Permalink
#129 Fix infinite loop in modula folder.
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamatongwe committed Jan 22, 2023
1 parent 8bc8ee6 commit 302e75a
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 1 deletion.
4 changes: 4 additions & 0 deletions doc/LexillaHistory.html
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,10 @@ <h3>
<a href="https://github.com/ScintillaOrg/lexilla/issues/129">Issue #129</a>.
</li>
<li>
Modula-3: Fix endless loop in folder.
<a href="https://github.com/ScintillaOrg/lexilla/issues/128">Issue #128</a>.
</li>
<li>
Python: Don't highlight match and case as keywords in contexts where they probably aren't used as keywords.
<a href="https://github.com/ScintillaOrg/lexilla/pull/122">Pull request #122</a>.
</li>
Expand Down
2 changes: 1 addition & 1 deletion lexers/LexModula.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ static void FoldModulaDoc( Sci_PositionU startPos,
if( clv_new < clv_old ) {
nextLevel--;
pos = styler.LineStart( cln );
while( ( ch = styler.SafeGetCharAt( pos ) ) != '\n' ) {
while( ( ch = styler.SafeGetCharAt( pos, '\n' )) != '\n') {
if( ch == 'P' ) {
if( styler.StyleAt(pos) == SCE_MODULA_KEYWORD ) {
if( checkKeyIdentOper( styler, pos, endPos,
Expand Down
15 changes: 15 additions & 0 deletions test/examples/modula/128Endless.m3
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(* This file caused an infinite loop in the folder before #128 was fixed.*)
MODULE Form;
IMPORT

PROCEDURE (bf: ButtonForm) InitializeComponent(), NEW;
BEGIN
bf.SuspendLayout();
REGISTER(bf.button1.Click, bf.button1_Click);
bf.get_Controls().Add(bf.button2);
END InitializeComponent;

BEGIN
NEW(bf);
Wfm.Application.Run(bf);
END Form.
16 changes: 16 additions & 0 deletions test/examples/modula/128Endless.m3.folded
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
0 400 0 (* This file caused an infinite loop in the folder before #128 was fixed.*)
0 400 0 MODULE Form;
0 400 0 IMPORT
0 400 0
0 400 0 PROCEDURE (bf: ButtonForm) InitializeComponent(), NEW;
0 400 0 BEGIN
0 400 0 bf.SuspendLayout();
0 400 0 REGISTER(bf.button1.Click, bf.button1_Click);
0 400 0 bf.get_Controls().Add(bf.button2);
0 400 0 END InitializeComponent;
0 400 0
0 400 0 BEGIN
0 400 0 NEW(bf);
0 400 0 Wfm.Application.Run(bf);
0 400 0 END Form.
0 400 0
15 changes: 15 additions & 0 deletions test/examples/modula/128Endless.m3.styled
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{1}(* This file caused an infinite loop in the folder before #128 was fixed.*){0}
{4}MODULE{0} Form{16};{0}
{4}IMPORT{0}

{4}PROCEDURE{0} {16}({0}bf{16}:{0} ButtonForm{16}){0} InitializeComponent{16}(),{0} {5}NEW{16};{0}
{4}BEGIN{0}
bf{16}.{0}SuspendLayout{16}();{0}
REGISTER{16}({0}bf{16}.{0}button1{16}.{0}Click{16},{0} bf{16}.{0}button1_Click{16});{0}
bf{16}.{0}get_Controls{16}().{0}Add{16}({0}bf{16}.{0}button2{16});{0}
{4}END{0} InitializeComponent{16};{0}

{4}BEGIN{0}
{5}NEW{16}({0}bf{16});{0}
Wfm{16}.{0}Application{16}.{0}Run{16}({0}bf{16});{0}
{4}END{0} Form{16}.{0}
3 changes: 3 additions & 0 deletions test/examples/modula/SciTE.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ keywords4.*.m3= EXTERNAL INLINE ASSERT TRACE FATAL UNUSED\
keywords5.*.m3= f n r t \ " '
# Doxygene keywords
keywords6.*.m3= author authors file brief date proc param result

# Due to #131 causing exceptions, folding has to be turned off
fold=0

0 comments on commit 302e75a

Please sign in to comment.