Giter VIP home page Giter VIP logo

Comments (2)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
The problem occurs whenever a #include statement is entered in interactive 
mode. The crash occurs in LexCopyTokens at the line:

if (EndParser->Pos >= StartParser->Pos && EndParser->Pos < 
&pc->InteractiveCurrentLine->Tokens[pc->InteractiveCurrentLine->NumBytes])

because pc->InteractiveCurrentLine is null. The root of the problem appears to 
be that Picoc_struct has global lexer data, but when you're in immediate mode 
and you #include, you're re-entering the lexer.

I believe I've solved this.

In include.c, in void IncludeFile(Picoc *pc, char *FileName), replace:

   PicocPlatformScanFile(pc, FileName);

with code that saves the global values, sets them to NULL, then restores them 
afterwards:

    {
        struct TokenLine *head = pc->InteractiveHead, *tail = pc->InteractiveTail, *line = pc->InteractiveCurrentLine;
        pc->InteractiveHead = pc->InteractiveTail = pc->InteractiveCurrentLine = NULL;
        PicocPlatformScanFile(pc, FileName);
        pc->InteractiveHead = head;
        pc->InteractiveTail = tail;
        pc->InteractiveCurrentLine = line;
    }

Original comment by [email protected] on 5 Aug 2015 at 2:30

from picoc.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 19, 2024
This is fixed on my fork at https://github.com/galacticstudios/picoc

Original comment by [email protected] on 17 Aug 2015 at 3:09

from picoc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.